示例#1
0
        public void BrowseTest()
        {
            var mediaDal = new MockMediaDal
            {
                ThrowError = false
            };
            var controller = new BorrowController(new MockBorrowDal(), mediaDal, new MockMemberDal());
            var result     = (ViewResult)controller.Browse();

            Assert.AreEqual("Browse", result.ViewName);
            var actualList = (List <Media>)result.Model;

            Assert.AreEqual(1, actualList.Count);
        }
示例#2
0
        public void BrowseTestWithException()
        {
            var mediaDal = new MockMediaDal
            {
                ThrowError = true
            };
            var controller = new BorrowController(new MockBorrowDal(), mediaDal, new MockMemberDal());
            var result     = (ViewResult)controller.Browse();

            Assert.AreEqual(null, result.ViewName);
            Assert.AreEqual("Uh-oh.. something went wrong", result.ViewData["Error"]);
            var actualList = (List <Media>)result.Model;

            Assert.AreEqual(0, actualList.Count);
        }