This is required by the C# compiler, so it is not optional. For your source generator, you need to make the following additions to the project file.įirst, you need to set the target framework to. Project StructureĪt the bare minimum you need two projects, one for the source generator itself and one to test it against. In this walk through, we’ll explore how to create such a test generator. What if we can use a code generator to create these low value tests? If we reduce them to just an attribute, we could get out test coverage while freeing up the developer to focus on the more difficult tests. But ‘almost never’ isn’t the same as ‘never’ and they should be tested. Nobody wants to write those tests because they are tedious and almost never detect a bug. Var readOnce = readTwice = readTwice, "Reading a property twice should return the same value both times.") Public void objectUnderTest = CreateObject() Īssert.AreEqual(originalValue, "Assigning a property to itself should not change its value.") Here’s an example of testing property getters and setters to insure they perform as intended:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |