DogController CreateDogController() { var testData = FakePedigree.CreateTestDogs(); var repository = new FakeDogRepository(testData); return new DogController(repository); }
public void Pedigree_ValidView() { var controller = CreateDogController(); var testData = FakePedigree.CreateTestDogs(); FakeDogRepository fakeDb = new FakeDogRepository(testData); var result = controller.Pedigree() as ViewResult; Assert.IsNotNull(result); }
public void DogTest() { var controller = CreateDogController(); var testData = FakePedigree.CreateTestDogs(); FakeDogRepository fakeDb = new FakeDogRepository(testData); int numberOfDogs = fakeDb.NumberOfDogs(); Dog dog = fakeDb.Find(3); Assert.AreEqual(numberOfDogs, 4); Assert.AreEqual(dog.Name, "Hvolpur1"); Assert.AreEqual(dog.LitterId, 2); }