示例#1
0
        public void Test_Details_Return_NotFound()
        {
            // Arrange
            IOperaRepository repo       = new TestOperaRepository();
            OperaController  controller = new OperaController(repo);
            var expected = 404;

            // Act
            var result = controller.Details(0) as HttpNotFoundResult;

            // Assert
            Assert.AreEqual(expected, result.StatusCode);
        }
示例#2
0
        public void Test_Details_Return_Opera()
        {
            // Arrange
            IOperaRepository repo       = new TestOperaRepository();
            OperaController  controller = new OperaController(repo);
            var expected = 201;

            // Act
            var result = controller.Details(1) as ViewResult;
            var opera  = result.Model as Opera;

            // Assert
            Assert.AreEqual(expected, opera.OperaID);
        }