Example #1
0
        public void Delete()
        {
            TamagotchisController tamagotchisController = new TamagotchisController(new DummyTamagotchiRepository());

            // Act
            ViewResult result = tamagotchisController.Edit(1) as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
Example #2
0
        public void DeleteConfirmed()
        {
            ITamagotchiRepository tamagotchiRepository  = new DummyTamagotchiRepository();
            TamagotchisController tamagotchisController = new TamagotchisController(tamagotchiRepository);
            TamagotchiModel       subject = tamagotchiRepository.Get(2);

            tamagotchisController.DeleteConfirmed(2);

            Assert.IsTrue(!tamagotchiRepository.GetAll().Contains(subject));
        }
Example #3
0
        public void TamagotchisControllerIndexNotNull()
        {
            // Arrange
            var controller = new TamagotchisController();

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert

            Assert.IsNotNull(result);
        }
Example #4
0
        public void EditPost()
        {
            ITamagotchiRepository tamagotchiRepository  = new DummyTamagotchiRepository();
            TamagotchisController tamagotchisController = new TamagotchisController(tamagotchiRepository);
            TamagotchiModel       tam1 = tamagotchiRepository.Get(1);

            tam1.Level    = 85;
            tam1.Leeftijd = 72;

            tamagotchisController.Edit(tam1);

            Assert.AreEqual(tam1, tamagotchiRepository.Get(1));
        }
Example #5
0
        public void CreatePost()
        {
            ITamagotchiRepository tamagotchiRepository  = new DummyTamagotchiRepository();
            TamagotchisController tamagotchisController = new TamagotchisController(tamagotchiRepository);

            // Act
            TamagotchiModel newtamagotchi = new TamagotchiModel()
            {
                Naam = "testTamagochi"
            };
            RedirectToRouteResult result = tamagotchisController.Create(newtamagotchi) as RedirectToRouteResult;

            Assert.IsTrue(tamagotchiRepository.GetAll().Contains(newtamagotchi));

            Assert.IsNotNull(result);
        }