public async Task Should_Update_Basket() { using (var context = await MockDbContext.GetDbContext()) { controller = new BasketsController(context); var basketMock = context.Find <Basket.API.Models.Basket>(1); basketMock.State = BasketStates.SENT; var actionResult = await controller.PutItemAsync(basketMock, 1) as NoContentResult; Assert.Equal((int)HttpStatusCode.NoContent, actionResult.StatusCode); } }
public async Task Should_Update_Bookings_When_Basket_Validated() { using (var context = await MockDbContext.GetDbContext()) { controller = new BasketsController(context); var basketMock = context.Find <Basket.API.Models.Basket>(2); basketMock.State = BasketStates.VALIDATED; var actionResult = await controller.PutItemAsync(basketMock, 2); var basketBookings = context.Set <Booking>().Where(x => x.BasketID == basketMock.Id && x.DeletedAt == null).ToList(); Assert.Empty(basketBookings); } }