Пример #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());
        }
Пример #5
0
        public void Constructor_SetsProperties()
        {
            var dut = new GetAllAreasQuery("PCS$TESTPLANT");

            Assert.AreEqual("PCS$TESTPLANT", dut.Plant);
        }