public void Pending_ShouldReturnViewResultWithAllPendingBookingsForCurrentHost()
        {
            //Arrange
            var userId           = "id";
            var expectedPicUrl   = "pic";
            var expectedBookings = new List <HostBookingsServiceModel>
            {
                new HostBookingsServiceModel
                {
                    CheckInDate            = DateTime.UtcNow.AddDays(10),
                    CheckOutDate           = DateTime.UtcNow.AddDays(11),
                    GuestId                = "guest",
                    GuestProfilePictureUrl = expectedPicUrl,
                    GuestUsername          = "******",
                    Id         = 1,
                    TotalPrice = 10
                }
            };

            var userManager = UserManagerMock.New;

            userManager
            .Setup(um => um.GetUserId(It.IsAny <ClaimsPrincipal>()))
            .Returns(userId);

            var pictureService = PictureServiceMock.New;

            pictureService
            .Setup(ps => ps.PreparePictureToDisplay(It.IsAny <string>()))
            .Returns(expectedPicUrl);

            var bookingService = BookingServiceMock.New;

            bookingService
            .Setup(bs => bs.HostBookings(It.IsAny <int>(), It.IsAny <int>(), It.Is <string>(id => id == userId), false))
            .Returns(expectedBookings);

            var controller = new BookingsController(bookingService.Object, userManager.Object, pictureService.Object);

            //Act
            var result = controller.Pending();

            //Assert
            result
            .Should()
            .BeOfType <ViewResult>()
            .Subject
            .Model
            .Should()
            .Match(m => m.As <HostBookingsViewModel>().Bookings.Equals(expectedBookings));
        }
        public void Pending_ShouldReturnAllPendingBookingsForCurrentUser()
        {
            //Arrange
            var userId           = "id";
            var expectedBookings = new List <GuestBookingServiceModel>
            {
                new GuestBookingServiceModel
                {
                    CheckInDate   = DateTime.MinValue,
                    CheckOutDate  = DateTime.MaxValue,
                    GuestId       = userId,
                    GuestUsername = "******",
                    HomeId        = 1,
                    OwnerUsername = "******",
                    PricePerNight = 10,
                    TotalPrice    = 10000000
                }
            };

            var userManager = UserManagerMock.New;

            userManager
            .Setup(um => um.GetUserId(It.IsAny <ClaimsPrincipal>()))
            .Returns(userId);

            var bookingService = BookingServiceMock.New;

            bookingService
            .Setup(bs => bs.GuestBookings(It.Is <string>(id => id == userId), false))
            .Returns(expectedBookings);

            var controller = new BookingsController(bookingService.Object, null, userManager.Object);

            //Act
            var result = controller.Pending();

            //Assert
            result
            .Should()
            .BeOfType <ViewResult>()
            .Subject
            .Model
            .Should()
            .Match(m => m.As <IEnumerable <GuestBookingServiceModel> >().Equals(expectedBookings));
        }