Testing Basics
Assert True
Check whether a condition is true and report a simple pass or fail result.
Assert True
AssertTrue.cs
using System;
class Program
{
static void Main()
{
int score = ;
bool passedCondition = score >= 60;
string result = passedCondition ? "pass" : "fail";
Console.WriteLine($"score={score}");
Console.WriteLine($"condition={passedCondition}");
Console.WriteLine($"result={result}");
}
}
using System;
class Program
{
static void Main()
{
int score = ;
bool passedCondition = score >= 60;
string result = passedCondition ? "pass" : "fail";
Console.WriteLine($"score={score}");
Console.WriteLine($"condition={passedCondition}");
Console.WriteLine($"result={result}");
}
}
using System;
class Program
{
static void Main()
{
int score = ;
bool passedCondition = score >= 60;
string result = passedCondition ? "pass" : "fail";
Console.WriteLine($"score={score}");
Console.WriteLine($"condition={passedCondition}");
Console.WriteLine($"result={result}");
}
}
testing
The smallest test assertion checks a condition and records whether the condition matched the expectation.