Jun 1, 2025
Fact and TheoryCreate xUnit Test Project
round-the-code.xunitCreate Class Library for Testing
round-the-code.xunit-domethodsNumberHelperIsOddNumber: Checks if a number is odd using number % 2 == 1IsEvenNumber: Checks if a number is evenRatingScore: Uses switch statements to rate scores:
Adding Test Classes
NumberHelperFactTestsWriting Fact Tests
IsOddNumber: Value 3 should return trueIsOddNumber: Value 6 should return falseIsEvenNumber: Value 3 should return falseIsEvenNumber: Value 6 should return trueAssert.True or Assert.False[Fact] attribute to each methodWriting Theory Tests
NumberHelperTheoryTests[Fact] to [Theory][InlineData] to test multiple inputsTesting Rating Scores
Assert.Equal and Assert.NotEqualRatingScore: Value 7 should return "great"RatingScore: Value 7 should not return "bad"[Theory] with multiple [InlineData]