public IHttpActionResult PostDoubleBooking(DoubleBooking doubleBooking) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _doubleBookingService.Add(doubleBooking); return(CreatedAtRoute("DefaultApi", new { id = doubleBooking.DoubleBookingId }, doubleBooking)); }
public void SupportPostDoubleBooking() { var doubleBooking = new DoubleBooking() { AuthorityId = 2, BookingDate = DateTime.MinValue, SearchClerkId = 3 }; _doubleBookingsService.Add(doubleBooking).Returns(doubleBooking); var response = _doubleBookingsController.PostDoubleBooking(doubleBooking); var contentResult = response as CreatedAtRouteNegotiatedContentResult <DoubleBooking>; contentResult.Content.Should().NotBeNull(); contentResult.Content.AuthorityId.Should().Be(2); contentResult.Content.BookingDate.Should().Be(DateTime.MinValue); contentResult.Content.SearchClerkId.Should().Be(3); }