public void TestDataManupulation() { //here we call the fake db context following the Unit Test rules Console.WriteLine("Dependency injection now"); RealUse realFake = new RealUse(new DbContextFake()); if (realFake.ManipulateData()) { //assert true } }
static void Main(string[] args) { Console.WriteLine("Production"); //we do not need to inject a dbcontext here because by default it uses the real one RealUse real = new RealUse(); real.ManipulateData(); Console.WriteLine("Unit Testing"); UnitTest tdd = new UnitTest(); tdd.TestDataManupulation(); Console.ReadKey(); }