public async Task CanGetAllEmployedCashiersWhenNoneHaveBeenHired(GetEmployedCashiers query) { // Arrange // Purposefully not hiring any cashiers // Act var cashiers = await _fixture.SendAsync(query); // Assert (cashiers.Count == 0).ShouldBeTrue(); }
public async Task CanGetAllEmployedCashiers(GetEmployedCashiers query, Cashier[] cashiersToHire) { // Arrange await _fixture.ExecuteDbContextAsync(async dbContext => { dbContext.Cashiers.AddRange(cashiersToHire); await dbContext.SaveChangesAsync(); }); // Act var cashiers = await _fixture.SendAsync(query); // Assert (cashiers.Count == cashiersToHire.Length && cashiers.All(c => cashiersToHire.Any(hiredCashier => c.Id == hiredCashier.Id && c.ShortName == hiredCashier.ShortName))) .ShouldBeTrue(); }
public Task <IList <CashierView> > Handle(GetEmployedCashiers request, CancellationToken cancellationToken) => _cashierViewRepository .GetAll();