![]() ![]() ![]() Public void GivenTwoNumbers_WhenAdd_ReturnSum(int term1, int term2, int sum) This method call Given and When, in any order, to setup the test pipeline with test data and the method to test.įinally verify the result by calling Then().Result (or only Result) on the returned pipeline and check the result with Is. Then create a test-method, attributed with Theory and InlineData, called When. If you are used to writing one test class per production class and use Theory for test input, you can use a similar style with XspecT.įirst you create your test-class overriding StaticSpec with the expected return type as generic argument. ![]() This is an example of a complete test class ( specification) with one test method ( requirement): using XspecT.Verification Is-assertions are recommended ovr Should-assertions for making the tests read more like specifications, listing requirements rather than asserting expected results. This package includes a fluent assertion framework, which is built upon FluentAssertions, but with a less worthy syntax, based on the verb Is instead of Should. It is assumed that you are already familiar with Xunit and Moq, or similar test- and mocking frameworks. Whether you are beginner or expert in unit-testing, this framework will help you to write more descriptive, concise and maintainable tests. Net in a fluent style,īased on the popular "Given-When-Then" pattern, built upon XUnit, Moq, AutoMock, AutoFixture and FluentAssertions. Framework for writing and running automated tests in. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |