Exemplo n.º 1
0
        public async Task Then_If_OrgId_Not_Supplied_Return_BadRequest(
            [Frozen] Mock <IMediator> mediator,
            StandardQueryController controller)
        {
            // Arrange

            var epaoId = string.Empty;

            mediator
            .Setup(x => x.Send(
                       It.Is <EpaoPipelineStandardsFiltersRequest>(c => c.EpaoId.Equals(epaoId)),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(new EpaoPipelineStandardsFiltersResponse()
            {
            });

            // Act

            var actual = await controller.GetEpaoPipelineStandardsFilters(epaoId);

            // Assert

            actual.Should().NotBeNull();
            var actualResult = actual as BadRequestResult;

            actualResult.Should().NotBeNull();
        }
Exemplo n.º 2
0
        public async Task Then_If_No_Pipeline_Data_Return_Ok_No_Data(
            string epaoId,
            [Frozen] Mock <IMediator> mediator,
            StandardQueryController controller)
        {
            // Arrange

            mediator
            .Setup(x => x.Send(
                       It.Is <EpaoPipelineStandardsFiltersRequest>(c => c.EpaoId.Equals(epaoId)),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(new EpaoPipelineStandardsFiltersResponse()
            {
                StandardFilterItems = new List <EpaoPipelineStandardFilter>(),
                ProviderFilterItems = new List <EpaoPipelineStandardFilter>(),
                EPADateFilterItems  = new List <EpaoPipelineStandardFilter>(),
            });

            // Act

            var actual = await controller.GetEpaoPipelineStandardsFilters(epaoId);

            // Assert

            actual.Should().NotBeNull();
            var actualResult = actual as OkObjectResult;

            actualResult.Should().NotBeNull();
            var actualModel = actualResult.Value as EpaoPipelineStandardsFiltersResponse;

            actualModel.StandardFilterItems.Should().NotBeNull();
            actualModel.StandardFilterItems.Should().BeEmpty();
            actualModel.ProviderFilterItems.Should().NotBeNull();
            actualModel.ProviderFilterItems.Should().BeEmpty();
            actualModel.EPADateFilterItems.Should().NotBeNull();
            actualModel.EPADateFilterItems.Should().BeEmpty();
        }
Exemplo n.º 3
0
        public async Task Then_If_Pipeline_Data_Exists_Return_Ok_With_Filters(
            string epaoId,
            [Frozen] Mock <IMediator> mediator,
            StandardQueryController controller)
        {
            // Arrange

            mediator
            .Setup(x => x.Send(
                       It.Is <EpaoPipelineStandardsFiltersRequest>(c => c.EpaoId.Equals(epaoId)),
                       It.IsAny <CancellationToken>()))
            .ReturnsAsync(new EpaoPipelineStandardsFiltersResponse()
            {
                StandardFilterItems = new List <EpaoPipelineStandardFilter>()
                {
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "271", Value = "Advanced Baker"
                    },
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "303", Value = "Asbestos analyst and surveyor"
                    },
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "54", Value = "Butcher"
                    },
                },
                ProviderFilterItems = new List <EpaoPipelineStandardFilter>()
                {
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "10026402", Value = "ACTIONS LIMTED"
                    },
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "10061684", Value = "ALL SPRING MEDIA LIMITED"
                    },
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "10037442", Value = "ADVANCED CARE YORKSHIRE LIMTED"
                    },
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "10000460", Value = "AUTOMOTIVE TRANSPORT TRAINING LIMITED"
                    },
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "10057058", Value = "L C PARTNERSHIP LTD"
                    },
                },
                EPADateFilterItems = new List <EpaoPipelineStandardFilter>()
                {
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "202108", Value = "August 2021"
                    },
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "202109", Value = "September 2021"
                    },
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "202110", Value = "October 2021"
                    },
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "202111", Value = "November 2021"
                    },
                    new EpaoPipelineStandardFilter()
                    {
                        Id = "202112", Value = "December 2021"
                    },
                }
            });

            // Act

            var actual = await controller.GetEpaoPipelineStandardsFilters(epaoId);

            // Assert

            actual.Should().NotBeNull();
            var actualResult = actual as OkObjectResult;

            actualResult.Should().NotBeNull();
            var actualModel = actualResult.Value as EpaoPipelineStandardsFiltersResponse;

            actualModel.StandardFilterItems.Should().NotBeNull();
            actualModel.StandardFilterItems.Should().HaveCount(3);
            actualModel.ProviderFilterItems.Should().NotBeNull();
            actualModel.ProviderFilterItems.Should().HaveCount(5);
            actualModel.EPADateFilterItems.Should().NotBeNull();
            actualModel.EPADateFilterItems.Should().HaveCount(5);
        }