コード例 #1
0
        public async Task UpdateBookingShouldUpdateFieldsAsync()
        {
            // arrange
            var booking = new BookingEntity {
                Id = Guid.NewGuid(), UserEntityId = _currentUserEntity.Id
            };

            _bookingList.Add(booking);

            var model = new UpdateBookingModel
            {
                BookingStatusCode   = "testBookingUpdate",
                SelfBooked          = true,
                DateOfBooking       = DateTime.UtcNow.ToLocalTime(),
                OtherBookingDetails = "testOtherBookingDetails"
            };

            // act
            var result = await _bookingsQueryProcessor.Update(booking.Id, model);

            // assert
            result.Should().Be(booking);
            result.BookingStatusCode.Should().Be(model.BookingStatusCode);
            result.SelfBooked.Should().Be(model.SelfBooked);
            result.UserEntityId.Should().Be(_currentUserEntity.Id);

            _unitOfWorkMock.Verify(x => x.CommitAsync());
        }
コード例 #2
0
        public async Task <BookingModel> PutAsync(Guid id, [FromBody] UpdateBookingModel model)
        {
            var item = await _bookingsQuery.Update(id, model);

            var resultModel = _mapper.Map <BookingModel>(item);

            return(resultModel);
        }