Пример #1
0
 public ViewResult NewBooking(int year, int month, int day)
 {
     var date = new DateTime(year, month, day);
     var remaining = this.dayReader.GetRemainingCapacity(date);
     var model = new BookingViewModel { Date = date, Remaining = remaining };
     return this.View(model);
 }
Пример #2
0
 public void PostSendsOnChannel(
     [Frozen]Mock<IChannel<RequestReservationCommand>> channelMock,
     BookingController sut,
     BookingViewModel model)
 {
     sut.Post(model);
     var expected = model.MakeReservation().AsSource().OfLikeness<RequestReservationCommand>().Without(d => d.Id);
     channelMock.Verify(c => c.Send(It.Is<RequestReservationCommand>(x => expected.Equals(x))));
 }
Пример #3
0
        public ViewResult NewBooking(BookingViewModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            this.channel.Send(model.MakeNewReservation());
            return this.View("BookingReceipt", model);
        }
Пример #4
0
        public ViewResult NewBooking(int year, int month, int day)
        {
            var date      = new DateTime(year, month, day);
            var remaining = this.dayReader.GetRemainingCapacity(date);
            var model     = new BookingViewModel {
                Date = date, Remaining = remaining
            };

            return(this.View(model));
        }
Пример #5
0
        public ViewResult NewBooking(BookingViewModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            this.channel.Send(model.MakeNewReservation());
            return(this.View("BookingReceipt", model));
        }
Пример #6
0
 public void NewBookingPostReturnsCorrectViewName(HomeController sut, BookingViewModel model)
 {
     var result = sut.NewBooking(model);
     Assert.Equal("BookingReceipt", result.ViewName);
 }
Пример #7
0
 public void NewBookingPostReturnsCorrectTypeOfModel(HomeController sut, BookingViewModel model)
 {
     var result = sut.NewBooking(model);
     Assert.IsAssignableFrom<BookingViewModel>(result.ViewData.Model);
 }
Пример #8
0
 public void NewBookingPostReturnsCorrectModel(HomeController sut, BookingViewModel model)
 {
     var result = sut.NewBooking(model);
     Assert.Equal(model, result.ViewData.Model);
 }
Пример #9
0
 public void NewBookingPostCorrectlySendsOnChannel([Frozen]Mock<IChannel> channelMock, HomeController sut, BookingViewModel model)
 {
     sut.NewBooking(model);
     var expected = model.AsSource().OfLikeness<MakeReservationCommand>().Without(d => d.Id);
     channelMock.Verify(c => c.Send(expected));
 }
Пример #10
0
 public void DateIsCorrect([Frozen]DateTime date, BookingViewModel sut)
 {
     Assert.Equal(date, sut.Date);
 }
Пример #11
0
 public void PostReturnsCorrectViewName(BookingController sut,
     BookingViewModel model)
 {
     ViewResult actual = sut.Post(model);
     Assert.Equal("Receipt", actual.ViewName);
 }
Пример #12
0
 public void PostReturnsCorrectModel(BookingController sut,
     BookingViewModel expected)
 {
     var actual = sut.Post(expected);
     Assert.Equal(expected, actual.Model);
 }
Пример #13
0
 public void NewBookingPostReturnsInstance(HomeController sut, BookingViewModel model)
 {
     ViewResult result = sut.NewBooking(model);
     Assert.NotNull(result);
 }
Пример #14
0
 public void EmailIsCorrect([Frozen]string email, BookingViewModel sut)
 {
     Assert.Equal<string>(email, sut.Email);
 }
Пример #15
0
 public void RemainingEstimateIsProperWritableProper(BookingViewModel sut, int remaining)
 {
     sut.Remaining = remaining;
     var result = sut.Remaining;
     Assert.Equal(remaining, result);
 }
Пример #16
0
 public void QuantityIsCorrect([Frozen]int quantity, BookingViewModel sut)
 {
     Assert.Equal(quantity, sut.Quantity);
 }
Пример #17
0
 public void NameIsCorrect([Frozen]string name, BookingViewModel sut)
 {
     Assert.Equal(name, sut.Name);
 }
Пример #18
0
 public void MakeNewReservationReturnsCorrectResult(BookingViewModel sut)
 {
     MakeReservationCommand result = sut.MakeNewReservation();
     var expected = sut.AsSource().OfLikeness<MakeReservationCommand>().Without(d => d.Id);
     expected.ShouldEqual(result);
 }
Пример #19
0
 public ViewResult Post(BookingViewModel model)
 {
     this.channel.Send(model.MakeReservation());
     return this.View("Receipt", model);
 }
Пример #20
0
 public ViewResult Post(BookingViewModel model)
 {
     this.channel.Send(model.MakeReservation());
     return(this.View("Receipt", model));
 }