示例#1
0
        public ActionResult Create(Sandwich sandwich)
        {
            var adminRole = new AdminRole();

            adminRole.AddSandwishInMenu(sandwich);

            return(RedirectToAction("Index"));
        }
        public void AdminRole_ThrowException_WhenInvalidSandwishIsProvided()
        {
            //Arrange
            var SandwishToUse = new Sandwich();

            //Act
            var adminRole = new AdminRole();

            //Assert
            Assert.ThrowsException <Exception>(() => adminRole.AddSandwishInMenu(SandwishToUse));
        }
        public void AdminRole_ThrowException_WhenNullSandwishIsProvided()
        {
            //Arrange
            var SandwishToUse = new Sandwich();

            //Act
            var adminRole = new AdminRole();

            //Assert
            Assert.ThrowsException <ArgumentNullException>(() => adminRole.AddSandwishInMenu(null));
        }
        public void AdminRole_ReturnTrue_WhenValidSandwishIsProvided()
        {
            //Arrange
            var SandwishToUse = new Sandwich {
                Name = "Thon Piquant2"
            };

            //Act
            var adminRole = new AdminRole();

            var resultAdd = adminRole.AddSandwishInMenu(SandwishToUse);

            //Assert
            Assert.IsTrue(resultAdd);
        }