C# 單元測試使用NUnit and Nsubstitute

C# 單元測試使用NUnit and Nsubstitute 

1.Nuget安裝Nunit、NUnit3TestAdapter and NBuilder

  1. NUnit is a unit-testing framework for all .Net languages. 
  2. NBuilder allows you to rapidly create test data, automatically assigning values to properties and public fields that are one of the built in .NET data types (e.g. ints and strings). NBuilder allows you to override for properties you are interested in using lambda expressions.

2.加入一個Model

3.加入一個商業邏輯

4.加入測試類別,並按下ctrl+R+T