コード例 #1
0
        // 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
            }));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        // 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
            });
        }