コード例 #1
0
        DogController CreateDogController()
        {
            var testData = FakePedigree.CreateTestDogs();
            var repository = new FakeDogRepository(testData);

            return new DogController(repository);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        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);
        }