public void FacadeInsertAMonumentAndRemoveContentCheck() { //Arrange MockRepository mockRepository = new MockRepository(); MonumentController monumentController = new MonumentController(mockRepository); Monument dummyMonument = new Monument() { Id = 1, MonumentNaam = "Manneke pis" }; //Act monumentController.Post(dummyMonument); monumentController.Delete((int)dummyMonument.Id); List <Monument> result = (List <Monument>)monumentController.Get(); //Assert Assert.AreEqual(1, mockRepository.NumberOfTimesAddCalled); Assert.AreEqual(1, mockRepository.NumberOfTimesRemoveCalled); CollectionAssert.DoesNotContain(result, dummyMonument); }
public void FacadeUpdateCallCount() { //Arrange MockRepository mockRepository = new MockRepository(); MonumentController monumentController = new MonumentController(mockRepository); Monument dummyMonument = new Monument() { Id = 1, MonumentNaam = "Manneke pis" }; //Act monumentController.Post(dummyMonument); dummyMonument.MonumentNaam = "Eifeltoren"; monumentController.Put((int)dummyMonument.Id, dummyMonument); Monument result = monumentController.Get(1); //Assert Assert.AreEqual(1, mockRepository.NumberOfTimesAddCalled); Assert.AreEqual(1, mockRepository.NumberOfTimesUpdateCalled); Assert.AreEqual(dummyMonument, result); }
public void FacadeGetAllMonumentsCallCount() { //Arrange MockRepository mockRepository = new MockRepository(); MonumentController monumentController = new MonumentController(mockRepository); //Act IEnumerable <Monument> result = monumentController.Get(); //Assert Assert.AreEqual(1, mockRepository.NumberOfTimesFindAllCalled); }
public void FacadeGetByIdCallCount() { //Arrange MockRepository mockRepository = new MockRepository(); MonumentController monumentController = new MonumentController(mockRepository); Monument dummyMonument = new Monument() { Id = 1, MonumentNaam = "Manneke pis" }; //Act monumentController.Post(dummyMonument); Monument result = monumentController.Get(1); //Assert Assert.AreEqual(1, mockRepository.NumberOfTimesAddCalled); Assert.AreEqual(1, mockRepository.NumberOfTimesFindCalled); Assert.AreEqual(dummyMonument, result); }