Пример #1
0
        public async Task Handle_ReturnsEmptyList_IfNoElementsAreFound()
        {
            _clientMock
            .Setup(x => x.QueryAndDeserializeAsync <List <MainApiResponsible> >(It.IsAny <string>()))
            .Returns(Task.FromResult <List <MainApiResponsible> >(null));

            var dut = new GetAllResponsiblesQueryHandler(_clientMock.Object, _optionsMonitorMock.Object);

            var result = await dut.Handle(_request, default);

            Assert.AreEqual(0, result.Data.Count());
        }
Пример #2
0
        public async Task HandleGetAllResponsiblesQueryHandler_ShouldReturnResponsibles()
        {
            using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider))
            {
                var _dut   = new GetAllResponsiblesQueryHandler(context);
                var result = await _dut.Handle(new GetAllResponsiblesQuery(), default);

                var responsibles = result.Data.ToList();

                Assert.AreEqual(1, responsibles.Count);
                var responsibleDto = responsibles.Single();
                Assert.AreEqual(_responsible.Code, responsibleDto.Code);
                Assert.AreEqual(_responsible.Description, responsibleDto.Description);
            }
        }
Пример #3
0
        public async Task Handle_ReturnsOkResult()
        {
            var result = await _dut.Handle(_request, default);

            Assert.AreEqual(ResultType.Ok, result.ResultType);
        }