public async Task HandleGetAllModesQueryHandler_ShouldNotReturnVoidedModes_WhenExcludedInRequest() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new GetAllModesQueryHandler(context); var result = await dut.Handle(new GetAllModesQuery(false), default); var modes = result.Data.ToList(); Assert.AreEqual(1, modes.Count); Assert.AreEqual(_mode2Title, modes.Single().Title); } }
public async Task HandleGetAllModesQueryHandler_ShouldReturnModes() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var dut = new GetAllModesQueryHandler(context); var result = await dut.Handle(new GetAllModesQuery(true), default); var modes = result.Data.ToList(); Assert.AreEqual(2, modes.Count); Assert.AreEqual(_mode1Title, modes.First().Title); Assert.AreEqual(_mode2Title, modes.Last().Title); Assert.IsTrue(modes.First().ForSupplier); Assert.IsFalse(modes.Last().ForSupplier); } }