Patrick's Blog

Patrick's Blog

Unit Testing C# Library (.NET Framework)
--- Fraction Example ---

Unit Testing C# Library (.NET Framework) --- Fraction Example ---

Testing code: github.com/Kealiwyn/TheFractionClassUnitTes..

When starting a C# library project you have to make sure you've chosen the Class Library (.NET Framework) as well as making sure that you do NOT place the solution and project in the same directory. image.png image.png

Without adding the class reference in your Unit Test Project it will not be able to tell where to look or what to be testing, you can do this by right clicking on the reference section of your Unit Test Project.

image.png

If you have any issues connecting your test environment to your Fraction class, verify that your class is Public, ensure the reference and possibly add the necessary "using" statements.

#csharp#testing#tdd#unit-testing
 
Share this