예제 #1
0
        public async Task Handle_ReturnsCorrectNumberOfElements()
        {
            var dut     = new GetAllAreasQueryHandler(_clientMock.Object, _optionsMonitorMock.Object);
            var request = new GetAllAreasQuery(Plant);

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

            Assert.AreEqual(2, result.Data.Count());
        }
예제 #2
0
        public async Task Handle_ReturnsOkResult()
        {
            var dut     = new GetAllAreasQueryHandler(_clientMock.Object, _optionsMonitorMock.Object);
            var request = new GetAllAreasQuery(Plant);

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

            Assert.AreEqual(ResultType.Ok, result.ResultType);
        }
예제 #3
0
        public async Task Handle_ProjectsElementsCorrectly()
        {
            var dut     = new GetAllAreasQueryHandler(_clientMock.Object, _optionsMonitorMock.Object);
            var request = new GetAllAreasQuery(Plant);

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

            Assert.AreEqual("CodeA", result.Data.ElementAt(0).Code);
            Assert.AreEqual("DescriptionA", result.Data.ElementAt(0).Description);
            Assert.AreEqual("CodeB", result.Data.ElementAt(1).Code);
            Assert.AreEqual("DescriptionB", result.Data.ElementAt(1).Description);
        }
예제 #4
0
        public async Task Handle_ReturnsEmptyList_IfNoElementsAreFound()
        {
            _clientMock
            .Setup(x => x.QueryAndDeserializeAsync <List <MainApiArea> >(It.IsAny <string>()))
            .Returns(Task.FromResult <List <MainApiArea> >(null));

            var dut     = new GetAllAreasQueryHandler(_clientMock.Object, _optionsMonitorMock.Object);
            var request = new GetAllAreasQuery(Plant);

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

            Assert.AreEqual(0, result.Data.Count());
        }