Пример #1
0
        public void Return_Subscriber_DetailModel()
        {
            var mockSubscriberService = new Mock <ISubscriber>();

            mockSubscriberService.Setup(r => r.Get(521)).Returns(GetSubscriber());
            var controller = new SubscriberController(mockSubscriberService.Object);

            var result = controller.Detail(521);

            var viewResult = result.Should().BeOfType <ViewResult>();

            viewResult.Subject.Model.Should().BeOfType <SubscriberDetailModel>();
        }
Пример #2
0
        public void Display_Nameless_Subscriber()
        {
            var mockSubscriberService = new Mock <ISubscriber>();

            mockSubscriberService.Setup(r => r.Get(429)).Returns(GetNamelessSubscriber());
            var controller = new SubscriberController(mockSubscriberService.Object);

            var result = controller.Detail(429);


            var viewResult = result.Should().BeOfType <ViewResult>();

            viewResult.Subject.Model.Should().BeOfType <SubscriberDetailModel>();
        }
Пример #3
0
        public void Return_Subscriber_Detail_View()
        {
            var mockSubscriberService = new Mock <ISubscriber>();

            mockSubscriberService.Setup(r => r.Get(429)).Returns(GetSubscriber());
            mockSubscriberService.Setup(r => r.GetRentals(429)).Returns(new List <Rental> {
            });
            mockSubscriberService.Setup(r => r.GetRentalHistories(429)).Returns(new List <RentalHistory> {
            });
            mockSubscriberService.Setup(r => r.GetHolds(429)).Returns(new List <Hold> {
            });
            var controller = new SubscriberController(mockSubscriberService.Object);

            var result = controller.Detail(429);

            var viewResult = result.Should().BeOfType <ViewResult>();
            var viewModel  = viewResult.Subject.ViewData.Model.Should().BeAssignableTo <SubscriberDetailModel>();

            viewModel.Subject.FirstName.Should().Be("Jim");
            viewModel.Subject.LastName.Should().Be("Brown");
        }