예제 #1
0
        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());
        }
예제 #2
0
        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);
        }
예제 #3
0
        public void DeleteConfirmed_RemovesBeast_Test()
        {
            //1. Arrange

            _beastcontroller = new BeastController(_beastRepository.Object, _accessoryRepository.Object, _boekingsRepository.Object);

            var Beast = new BeastVM {
                ID = 1, Name = "Leeuw", Type = "Jungle"
            };

            _beastRepository.Setup(b => b.Get(Beast.ID)).Returns(Beast.Beast);
            _beastRepository.Setup(b => b.ContextDB()).Returns(new BeesteOpJeFeestjeEntities());

            //2. Act
            _beastcontroller.DeleteConfirmed(Beast.ID);
            //3.Assert

            _beastRepository.Verify(b => b.Remove(Beast.Beast), Times.Once());
        }
예제 #4
0
        public void IndexBeast_ReturnsBeastList_Test()
        {
            //1. Arrange
            _beastcontroller = new BeastController(_beastRepository.Object, _accessoryRepository.Object, _boekingsRepository.Object);
            var beast = new BeastVM {
                ID = 1, Name = "Leeuw", Type = "Jungle"
            };
            var List = new List <Beast>();

            List.Add(beast.Beast);
            _beastRepository.Setup(b => b.GetAll()).Returns(List);

            //2. Act
            var result   = (ViewResult)_beastcontroller.Index();
            var SameList = (List <BeastVM>)result.ViewData.Model;

            //3.Assert
            Assert.AreEqual(List[0], SameList[0].Beast);
        }
예제 #5
0
        public void EditBeast_ReturnsInput_Test()
        {
            //1. Arrange

            _beastcontroller = new BeastController(_beastRepository.Object, _accessoryRepository.Object, _boekingsRepository.Object);

            var Beast = new BeastVM {
                ID = 1, Name = "Leeuw", Type = "Jungle"
            };

            _beastRepository.Setup(b => b.Get(Beast.ID)).Returns(Beast.Beast);
            _beastRepository.Setup(b => b.ContextDB()).Returns(new Domain.BeesteOpJeFeestjeEntities());

            //2. Act
            var result    = (ViewResult)_beastcontroller.Edit(Beast.ID);
            var SameBeast = (BeastVM)result.ViewData.Model;

            //3.Assert
            Assert.AreEqual(Beast.ID, SameBeast.ID);
            Assert.AreEqual(Beast.Name, SameBeast.Name);
            Assert.AreEqual(Beast.Type, SameBeast.Type);
        }