Exemple #1
0
        public void TestViewMemberHistoryNoException()
        {
            var mockRentalDal = new MockRentalDal
            {
                ThrowError = false
            };
            var controller = new LibrarianController(new MockMemberDal(), mockRentalDal);
            var result     = (ViewResult)controller.ViewMemberHistory("test");

            Assert.AreEqual("MemberHistory", result.ViewName);
            var members = (List <RentalItem>)result.Model;

            Assert.AreEqual(0, members.Count);
        }
Exemple #2
0
        public void TestViewMemberHistoryWithException()
        {
            var mockRentalDal = new MockRentalDal
            {
                ThrowError = true
            };
            var controller = new LibrarianController(new MockMemberDal(), mockRentalDal);
            var result     = (ViewResult)controller.ViewMemberHistory("test");

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

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