public void EditBeast_BeastIsUpdated_Test() { //1. Arrange _beastcontroller = new BeastController(_beastRepository.Object, _accessoryRepository.Object, _boekingsRepository.Object); var Beast = new BeastVM { Name = "Leeuw" }; //2. Act _beastcontroller.Edit(Beast); //3.Assert _beastRepository.Verify(b => b.UpdateBeast(Beast), Times.Once()); }
public void EditBeast_ReturnsBeast_Test() { //1. Arrange _beastcontroller = new BeastController(_beastRepository.Object, _accessoryRepository.Object, _boekingsRepository.Object); _beastcontroller.ModelState.AddModelError("test", "test"); var Beast = new BeastVM { ID = 1, Name = "Leeuw", Type = "Jungle" }; _beastRepository.Setup(b => b.ContextDB()).Returns(new Domain.BeesteOpJeFeestjeEntities()); //2. Act var result = (ViewResult)_beastcontroller.Edit(Beast); var SameBeast = (BeastVM)result.ViewData.Model; //3.Assert Assert.AreEqual(Beast.ID, SameBeast.ID); }