public async Task Handle_ReturnsEmptyList_IfNoElementsAreFound()
        {
            _clientMock
            .Setup(x => x.QueryAndDeserializeAsync <List <MainApiTagFunction> >(It.IsAny <string>()))
            .Returns(Task.FromResult <List <MainApiTagFunction> >(null));

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

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

            Assert.AreEqual(0, result.Data.Count());
        }
        public void Setup()
        {
            var options = new MainApiOptions
            {
                ApiVersion  = "1",
                Audience    = "Aud",
                BaseAddress = "http://example.com/"
            };

            _optionsMonitorMock = new Mock <IOptionsMonitor <MainApiOptions> >();
            _optionsMonitorMock
            .Setup(x => x.CurrentValue)
            .Returns(options);

            _request = new GetTagFunctionsQuery(Plant, RegisterCode);

            var url = $"{options.BaseAddress}Library/TagFunctions" +
                      $"?plantId={_request.Plant}" +
                      $"&registerCode={_request.RegisterCode}" +
                      $"&api-version={options.ApiVersion}";

            var tagFunctions = new List <MainApiTagFunction>
            {
                new MainApiTagFunction
                {
                    Code        = "CodeA",
                    Description = "DescriptionA"
                },
                new MainApiTagFunction
                {
                    Code        = "CodeB",
                    Description = "DescriptionB"
                }
            };

            _clientMock = new Mock <IBearerTokenApiClient>();
            _clientMock
            .Setup(x => x.QueryAndDeserializeAsync <List <MainApiTagFunction> >(url))
            .Returns(Task.FromResult(tagFunctions));
            _dut = new GetTagFunctionsQueryHandler(_clientMock.Object, _optionsMonitorMock.Object);
        }