public async Task ChangeRequestStatusOnInWork() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(databaseName: "ChangeRequestStatusOnInWork").Options; var context = new ApplicationDbContext(options); AddTestRequestWithStatuses(context); var query = new GetTestDataQuery(context); // Изменяет статус на "В работе". query.GetRequests().Where(s => s.Status.Equals(RequestStatus.REQ_STATUS_NEW)).Where(r => r.Number == 8508).ToList().ForEach(r => r.Status = RequestStatus.REQ_STATUS_IN_WORK); context.UpdateRange(query.GetRequests()); await context.SaveChangesAsync(); Assert.IsTrue(context.Requests.ToList().Any(e => e.Status.Equals(RequestStatus.REQ_STATUS_IN_WORK))); }
public void GetRequestsTest() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(databaseName: "GetRequestsTestAsync").Options; var context = new ApplicationDbContext(options); AddTestRequests(context); var query = new GetTestDataQuery(context); var result = query.GetRequests(); Assert.Equals(3, result.Count); }