// POST api/book public async Task <IHttpActionResult> Post(BookingRequestModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (model.BookingRequestId == Guid.Empty) { model.BookingRequestId = NewId.NextGuid(); } var address = ConfigurationManager.AppSettings["BookMeetingAddress"]; var endpoint = await WebApiApplication.Bus.GetSendEndpoint(new Uri(address)); var request = new BookMeetingCommand(model); await endpoint.Send(request); return(Accepted(new BookingRequestResult { BookingRequestId = model.BookingRequestId, Timestamp = request.Timestamp })); }
public async Task Should_insert_a_new_tracking_instance() { Guid sagaId = NewId.NextGuid(); var command = new BookMeetingCommand(sagaId, "*****@*****.**", new DateTime(2016, 10, 1, 14, 0, 0), TimeSpan.FromHours(1), 8); await Bus.Publish(new RequestReceived(sagaId, command)); Guid?foundSagaId = await _bookingRequestSagaRepository.ShouldContainSaga(sagaId, TestTimeout); Assert.IsTrue(foundSagaId.HasValue); Assert.AreEqual(sagaId, foundSagaId.Value); }
public async Task Should_insert_a_new_tracking_instance() { Guid sagaId = NewId.NextGuid(); var command = new BookMeetingCommand(sagaId, "*****@*****.**", new DateTime(2016, 10, 1, 14, 0, 0), TimeSpan.FromHours(1), 8); await Bus.Publish(new RequestReceived(sagaId, command)); Guid? foundSagaId = await _bookingRequestSagaRepository.ShouldContainSaga(sagaId, TestTimeout); Assert.IsTrue(foundSagaId.HasValue); Assert.AreEqual(sagaId, foundSagaId.Value); }
// POST api/book public async Task<IHttpActionResult> Post(BookingRequestModel model) { if (!ModelState.IsValid) return BadRequest(ModelState); if (model.BookingRequestId == Guid.Empty) model.BookingRequestId = NewId.NextGuid(); var address = ConfigurationManager.AppSettings["BookMeetingAddress"]; var endpoint = await WebApiApplication.Bus.GetSendEndpoint(new Uri(address)); var request = new BookMeetingCommand(model); await endpoint.Send(request); return Accepted(new BookingRequestResult { BookingRequestId = model.BookingRequestId, Timestamp = request.Timestamp }); }