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); }
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)))); }
public ViewResult NewBooking(BookingViewModel model) { if (model == null) { throw new ArgumentNullException("model"); } this.channel.Send(model.MakeNewReservation()); return this.View("BookingReceipt", model); }
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)); }
public ViewResult NewBooking(BookingViewModel model) { if (model == null) { throw new ArgumentNullException("model"); } this.channel.Send(model.MakeNewReservation()); return(this.View("BookingReceipt", model)); }
public void NewBookingPostReturnsCorrectViewName(HomeController sut, BookingViewModel model) { var result = sut.NewBooking(model); Assert.Equal("BookingReceipt", result.ViewName); }
public void NewBookingPostReturnsCorrectTypeOfModel(HomeController sut, BookingViewModel model) { var result = sut.NewBooking(model); Assert.IsAssignableFrom<BookingViewModel>(result.ViewData.Model); }
public void NewBookingPostReturnsCorrectModel(HomeController sut, BookingViewModel model) { var result = sut.NewBooking(model); Assert.Equal(model, result.ViewData.Model); }
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)); }
public void DateIsCorrect([Frozen]DateTime date, BookingViewModel sut) { Assert.Equal(date, sut.Date); }
public void PostReturnsCorrectViewName(BookingController sut, BookingViewModel model) { ViewResult actual = sut.Post(model); Assert.Equal("Receipt", actual.ViewName); }
public void PostReturnsCorrectModel(BookingController sut, BookingViewModel expected) { var actual = sut.Post(expected); Assert.Equal(expected, actual.Model); }
public void NewBookingPostReturnsInstance(HomeController sut, BookingViewModel model) { ViewResult result = sut.NewBooking(model); Assert.NotNull(result); }
public void EmailIsCorrect([Frozen]string email, BookingViewModel sut) { Assert.Equal<string>(email, sut.Email); }
public void RemainingEstimateIsProperWritableProper(BookingViewModel sut, int remaining) { sut.Remaining = remaining; var result = sut.Remaining; Assert.Equal(remaining, result); }
public void QuantityIsCorrect([Frozen]int quantity, BookingViewModel sut) { Assert.Equal(quantity, sut.Quantity); }
public void NameIsCorrect([Frozen]string name, BookingViewModel sut) { Assert.Equal(name, sut.Name); }
public void MakeNewReservationReturnsCorrectResult(BookingViewModel sut) { MakeReservationCommand result = sut.MakeNewReservation(); var expected = sut.AsSource().OfLikeness<MakeReservationCommand>().Without(d => d.Id); expected.ShouldEqual(result); }
public ViewResult Post(BookingViewModel model) { this.channel.Send(model.MakeReservation()); return this.View("Receipt", model); }
public ViewResult Post(BookingViewModel model) { this.channel.Send(model.MakeReservation()); return(this.View("Receipt", model)); }