Пример #1
0
        public void EditTest1()
        {
            // Arrange
            GenresController controller = new GenresController();

            // Act
            var result = controller.Edit(1);

            // Assert
            Assert.IsNotNull(result);
        }
        public void ValidEdit()
        {
            //Arrange
            FakeGenreBL      fake       = new FakeGenreBL();
            GenresController controller = new GenresController(fake);

            controller.testCase = true;
            //var result = (VideoGame)((ViewResult)controller.Details(1)).Model;
            // Act
            ViewResult result = controller.Edit(1) as ViewResult;

            // Assert
            Assert.AreEqual("Edit", result.ViewName);
        }
        public void EditNull()
        {
            //Arrange
            FakeNullGenre    fake       = new FakeNullGenre();
            GenresController controller = new GenresController(fake);

            controller.testCase = true;
            //var result = (VideoGame)((ViewResult)controller.Details(1)).Model;
            // Act
            ViewResult result = controller.Edit(3) as ViewResult;

            // Assert
            //Assert.AreEqual("", result.ViewName);
            Assert.IsNotNull(result.ViewName);
        }
        public void ValidEditSave()
        {
            //Arrange
            FakeGenreBL      fake       = new FakeGenreBL();
            GenresController controller = new GenresController(fake);

            controller.testCase = true;
            //var result = (VideoGame)((ViewResult)controller.Details(1)).Model;
            // Act
            Genre fps = new Genre {
                Name = "FPS", Description = "Men's romance"
            };
            ViewResult result = controller.Edit(fps) as ViewResult;

            // Assert
            Assert.AreEqual("Edit", result.ViewName);
        }