public void EditAccessory_AccessoryIsUpdated_Test() { //1. Arrange _accessorycontroller = new AccessoryController(_accessoryRepository.Object, _boekingsRepository.Object); var Accessory = new AccessoryVM { Name = "Speelbal" }; //2. Act _accessorycontroller.Edit(Accessory); //3.Assert _accessoryRepository.Verify(b => b.UpdateAccessory(Accessory), Times.Once()); }
public void EditAccessory_ReturnsAccessory_Test() { //1. Arrange _accessorycontroller = new AccessoryController(_accessoryRepository.Object, _boekingsRepository.Object); _accessorycontroller.ModelState.AddModelError("test", "test"); var Accessory = new AccessoryVM { ID = 1, Name = "Speelbal" }; _accessoryRepository.Setup(b => b.ContextDB()).Returns(new Domain.BeesteOpJeFeestjeEntities()); //2. Act var result = (ViewResult)_accessorycontroller.Edit(Accessory); var SameAccessory = (AccessoryVM)result.ViewData.Model; //3.Assert Assert.AreEqual(Accessory.ID, SameAccessory.ID); }