public void TestSimpleInjectionWorks() { //Arrange var dataStorage = new DataStorage(); var noteList = new NoteList(dataStorage); var noteText = "myCustomNote"; //Act noteList.Add(noteText); //Assert using (StreamReader reader = new StreamReader("db.txt")) { var all = reader.ReadToEnd(); Assert.IsTrue(all.Contains(noteText)); } File.Delete("db.txt"); }
public void TestInjectorWorks() { //Set injector Injector.Map<IDataStorage,DataStorage>(); //Arrange var dataStorage = Injector.Get<IDataStorage>(); var noteList = new NoteList(dataStorage); var noteText = "myCustomNote"; //Act noteList.Add(noteText); //Assert using (StreamReader reader = new StreamReader("db.txt")) { var all = reader.ReadToEnd(); Assert.IsTrue(all.Contains(noteText)); } File.Delete("db.txt"); }
public void TestInjectorWorks() { //Set injector Injector.Map <IDataStorage, DataStorage>(); //Arrange var dataStorage = Injector.Get <IDataStorage>(); var noteList = new NoteList(dataStorage); var noteText = "myCustomNote"; //Act noteList.Add(noteText); //Assert using (StreamReader reader = new StreamReader("db.txt")) { var all = reader.ReadToEnd(); Assert.IsTrue(all.Contains(noteText)); } File.Delete("db.txt"); }