public void CreateBeast_BeastIsAdded_Test() { //1. Arrange _beastcontroller = new BeastController(_beastRepository.Object, _accessoryRepository.Object, _boekingsRepository.Object); var Beast = new BeastVM { Name = "Leeuw" }; //2. Act _beastcontroller.Create(Beast); //3.Assert _beastRepository.Verify(b => b.Add(Beast.Beast), Times.Once()); }
public void CreateBeast_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.Create(Beast); var SameBeast = (BeastVM)result.ViewData.Model; //3.Assert Assert.AreEqual(Beast.ID, SameBeast.ID); }