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

            adminRole.AddSandwishInMenu(sandwich);

            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public void AdminRole_ThrowException_WhenInvalidSandwishIsProvided()
        {
            //Arrange
            var SandwishToUse = new Sandwich();

            //Act
            var adminRole = new AdminRole();

            //Assert
            Assert.ThrowsException <Exception>(() => adminRole.AddSandwishInMenu(SandwishToUse));
        }
コード例 #3
0
        public void AdminRole_ThrowException_WhenNullSandwishIsProvided()
        {
            //Arrange
            var SandwishToUse = new Sandwich();

            //Act
            var adminRole = new AdminRole();

            //Assert
            Assert.ThrowsException <ArgumentNullException>(() => adminRole.AddSandwishInMenu(null));
        }
コード例 #4
0
        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);
        }