public async Task Should_Return_NotFound_If_Basket_Doesnt_Exists() { using (var context = await MockDbContext.GetDbContext()) { controller = new BasketsController(context); var actionResult = await controller.DeleteItemAsync(15); Assert.Equal((int)HttpStatusCode.NotFound, (actionResult as NotFoundResult).StatusCode); } }
public async Task Should_Delete_Basket_And_Related_Bookings() { using (var context = await MockDbContext.GetDbContext()) { controller = new BasketsController(context); var actionResult = await controller.DeleteItemAsync(2); var basketBookings = context.Set <Booking>().Where(x => x.BasketID == 2 && x.DeletedAt == null).ToList(); Assert.Equal((int)HttpStatusCode.NoContent, (actionResult as NoContentResult).StatusCode); Assert.Empty(basketBookings); } }