public async Task Handle_ReturnsCorrectNumberOfElements()
        {
            _clientMock
            .Setup(x => x.QueryAndDeserializeAsync <List <MainApiDiscipline> >(_urlWithClassifications))
            .Returns(Task.FromResult(_disciplines));

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

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

            Assert.AreEqual(2, result.Data.Count());
        }
        public async Task Handle_ReturnsEmptyList_IfNoElementsAreFound()
        {
            _clientMock
            .Setup(x => x.QueryAndDeserializeAsync <List <MainApiDiscipline> >(It.IsAny <string>()))
            .Returns(Task.FromResult <List <MainApiDiscipline> >(null));

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

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

            Assert.AreEqual(0, result.Data.Count());
        }
        public async Task Handle_ReturnsAllElements_WhenNoClassificationsAreGiven()
        {
            _clientMock
            .Setup(x => x.QueryAndDeserializeAsync <List <MainApiDiscipline> >(_urlWithoutClassifications))
            .Returns(Task.FromResult(_disciplines));

            var request = new GetAllDisciplinesQuery(Plant, null);

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

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

            Assert.AreEqual(2, result.Data.Count());
        }
        public async Task Handle_ProjectsElementsCorrectly()
        {
            _clientMock
            .Setup(x => x.QueryAndDeserializeAsync <List <MainApiDiscipline> >(_urlWithClassifications))
            .Returns(Task.FromResult(_disciplines));

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

            var result = await dut.Handle(_requestWithClassifications, 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);
        }