Пример #1
0
        public async Task GetNotifications_GivenSearchFeedReturnsNoResultsWhenNoQueryParameters_EnsuresAtomLinksCorrect()
        {
            //Arrange
            SearchFeed <AllocationNotificationFeedIndex> feeds = new SearchFeed <AllocationNotificationFeedIndex>
            {
                PageRef    = 3,
                Top        = 500,
                TotalCount = 3,
                Entries    = CreateFeedIndexes()
            };

            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            feedsSearchService
            .GetFeeds(Arg.Is(3), Arg.Is(2), Arg.Any <IEnumerable <string> >())
            .Returns(feeds);

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            IHeaderDictionary headerDictionary = new HeaderDictionary();

            headerDictionary.Add("Accept", new StringValues("application/json"));

            IQueryCollection queryStringValues = new QueryCollection(new Dictionary <string, StringValues>
            {
                { "allocationStatuses", new StringValues("Published,Approved") },
                { "pageSize", new StringValues("2") }
            });

            HttpRequest request = Substitute.For <HttpRequest>();

            request.Scheme.Returns("https");
            request.Path.Returns(new PathString("/api/v1/test"));
            request.Host.Returns(new HostString("wherever.naf:12345"));
            request.Headers.Returns(headerDictionary);

            //Act
            IActionResult result = await service.GetNotifications(3, "Published,Approved", 2, request);

            //Assert
            result
            .Should()
            .BeOfType <ContentResult>();

            ContentResult contentResult         = result as ContentResult;
            AtomFeed <AllocationModel> atomFeed = JsonConvert.DeserializeObject <AtomFeed <AllocationModel> >(contentResult.Content);

            atomFeed
            .Should()
            .NotBeNull();

            atomFeed.Id.Should().NotBeEmpty();
            atomFeed.Title.Should().Be("Calculate Funding Service Allocation Feed");
            atomFeed.Author.Name.Should().Be("Calculate Funding Service");
            atomFeed.Link.First(m => m.Rel == "self").Href.Should().Be("https://wherever.naf:12345/api/v1/notifications?pageRef=3");
            atomFeed.Link.First(m => m.Rel == "first").Href.Should().Be("https://wherever.naf:12345/api/v1/notifications?pageRef=1");
            atomFeed.Link.First(m => m.Rel == "last").Href.Should().Be("https://wherever.naf:12345/api/v1/notifications?pageRef=1");
            atomFeed.Link.First(m => m.Rel == "previous").Href.Should().Be("https://wherever.naf:12345/api/v1/notifications?pageRef=2");
            atomFeed.Link.First(m => m.Rel == "next").Href.Should().Be("https://wherever.naf:12345/api/v1/notifications?pageRef=3");
        }
Пример #2
0
        public async Task GetNotifications_GivenAcceptHeaderNotSupplied_ReturnsBadRequest()
        {
            //Arrange
            SearchFeed <AllocationNotificationFeedIndex> feeds = new SearchFeed <AllocationNotificationFeedIndex>
            {
                PageRef    = 3,
                Top        = 500,
                TotalCount = 3,
                Entries    = CreateFeedIndexes()
            };

            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            feedsSearchService
            .GetFeeds(Arg.Is(3), Arg.Is(500), Arg.Any <IEnumerable <string> >())
            .Returns(feeds);

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            HttpRequest request = Substitute.For <HttpRequest>();

            request.Scheme.Returns("https");
            request.Path.Returns(new PathString("/api/v1/test/3"));
            request.Host.Returns(new HostString("wherever.naf:12345"));
            request.QueryString.Returns(new QueryString("?allocationStatuses=Published,Approved"));

            //Act
            IActionResult result = await service.GetNotifications(3, "Published,Approved", null, request);

            //Assert
            result
            .Should()
            .BeOfType <BadRequestResult>();
        }
Пример #3
0
        public async Task GetNotifications_GivenSearchFeedReturnsNoResultsForTheGivenPage_ReturnsNotFoundResult()
        {
            //Arrange
            SearchFeedV2 <AllocationNotificationFeedIndex> feeds = new SearchFeedV2 <AllocationNotificationFeedIndex>()
            {
                TotalCount = 1000,
                Entries    = Enumerable.Empty <AllocationNotificationFeedIndex>()
            };

            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            feedsSearchService
            .GetFeedsV2(Arg.Is(3), Arg.Is(500), statuses: Arg.Any <IEnumerable <string> >())
            .Returns(feeds);

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            HttpRequest request = Substitute.For <HttpRequest>();

            //Act
            IActionResult result = await service.GetNotifications(request, pageRef : 3, allocationStatuses : new[] { "Published", "Approved" });

            //Assert
            result
            .Should()
            .BeOfType <NotFoundResult>();
        }
Пример #4
0
        public ProviderResultsService(IAllocationNotificationsFeedsSearchService feedsService, ILogger logger)
        {
            Guard.ArgumentNotNull(feedsService, nameof(feedsService));
            Guard.ArgumentNotNull(logger, nameof(logger));

            _feedsService = feedsService;
            _logger       = logger;
        }
Пример #5
0
        public async Task GetNotifications_GivenSearchFeedReturnsResultsWhenNoQueryParameters_EnsuresAtomLinksCorrect()
        {
            //Arrange
            SearchFeedV2 <AllocationNotificationFeedIndex> feeds = new SearchFeedV2 <AllocationNotificationFeedIndex>
            {
                PageRef    = 2,
                Top        = 2,
                TotalCount = 8,
                Entries    = CreateFeedIndexes()
            };

            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            feedsSearchService
            .GetFeedsV2(Arg.Is(2), Arg.Is(2))
            .ReturnsForAnyArgs(feeds);

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            IHeaderDictionary headerDictionary = new HeaderDictionary();

            headerDictionary.Add("Accept", new StringValues("application/json"));

            HttpRequest request = Substitute.For <HttpRequest>();

            request.Scheme.Returns("https");
            request.Path.Returns(new PathString("/api/v2/allocations/notifications/2"));
            request.Host.Returns(new HostString("wherever.naf:12345"));
            request.Headers.Returns(headerDictionary);

            //Act
            IActionResult result = await service.GetNotifications(request, pageSize : 2, pageRef : 2);

            //Assert
            result
            .Should()
            .BeOfType <ContentResult>();

            ContentResult contentResult         = result as ContentResult;
            AtomFeed <AllocationModel> atomFeed = JsonConvert.DeserializeObject <AtomFeed <AllocationModel> >(contentResult.Content);

            atomFeed
            .Should()
            .NotBeNull();

            atomFeed.Id.Should().NotBeEmpty();
            atomFeed.Title.Should().Be("Calculate Funding Service Allocation Feed");
            atomFeed.Author.Name.Should().Be("Calculate Funding Service");
            atomFeed.Link.First(m => m.Rel == "prev-archive").Href.Should().Be("https://wherever.naf:12345/api/v2/allocations/notifications/1");
            atomFeed.Link.First(m => m.Rel == "next-archive").Href.Should().Be("https://wherever.naf:12345/api/v2/allocations/notifications/3");
            atomFeed.Link.First(m => m.Rel == "current").Href.Should().Be("https://wherever.naf:12345/api/v2/allocations/notifications/2");
            atomFeed.Link.First(m => m.Rel == "self").Href.Should().Be("https://wherever.naf:12345/api/v2/allocations/notifications");
        }
Пример #6
0
        public async Task GetNotifications_GivenMultipleStatuses_RequestsWithMultipleStatuses()
        {
            //Arrange
            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            HttpRequest request = Substitute.For <HttpRequest>();

            //Act
            IActionResult result = await service.GetNotifications(3, "Published,Approved", null, request);

            //Assert
            await
            feedsSearchService
            .Received(1)
            .GetFeeds(Arg.Is(3), Arg.Is(500), Arg.Is <string[]>(m => m.First() == "Published" && m.Last() == "Approved"));
        }
Пример #7
0
        public async Task GetNotifications_GivenPageRefOfThreeSupplied_RequestsPageThree()
        {
            //Arrange
            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            HttpRequest request = Substitute.For <HttpRequest>();

            //Act
            IActionResult result = await service.GetNotifications(3, "", null, request);

            //Assert
            await
            feedsSearchService
            .Received(1)
            .GetFeeds(Arg.Is(3), Arg.Is(500), Arg.Is <string[]>(m => m.First() == "Published"));
        }
Пример #8
0
        public async Task GetNotifications_GivenLaCode_ThenOnlyLaCodeRequested()
        {
            //Arrange
            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            IHeaderDictionary headerDictionary = new HeaderDictionary
            {
                { "Accept", new StringValues("application/json") }
            };

            IQueryCollection queryStringValues = new QueryCollection(new Dictionary <string, StringValues>
            {
                { "pageRef", new StringValues("1") },
                { "lacode", new StringValues("1015") },
                { "pageSize", new StringValues("2") }
            });

            HttpRequest request = Substitute.For <HttpRequest>();

            request.Scheme.Returns("https");
            request.Path.Returns(new PathString("/api/v2/test"));
            request.Host.Returns(new HostString("wherever.naf:12345"));
            request.QueryString.Returns(new QueryString("?pageRef=1&pageSize=2&lacode=1015"));
            request.Headers.Returns(headerDictionary);
            request.Query.Returns(queryStringValues);

            //Act
            IActionResult result = await service.GetNotifications(request, pageRef : 1, pageSize : 2, laCodes : new[] { "1015" });

            //Assert
            await feedsSearchService
            .Received(1)
            .GetFeedsV2(Arg.Is(1), Arg.Is(2), Arg.Any <int?>(), Arg.Any <int?>(), Arg.Any <IEnumerable <string> >(),
                        Arg.Is <IEnumerable <string> >(s => s.Count() == 1 && s.Contains("1015")),
                        Arg.Any <bool?>(),
                        Arg.Any <IEnumerable <string> >(),
                        Arg.Any <IEnumerable <string> >(), Arg.Any <IEnumerable <string> >());
        }
Пример #9
0
        public async Task GetNotifications_GivenSearchFeedReturnsNoResults_ReturnsNotFoundResult()
        {
            //Arrange
            SearchFeed <AllocationNotificationFeedIndex> feeds = new SearchFeed <AllocationNotificationFeedIndex>();

            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            feedsSearchService
            .GetFeeds(Arg.Is(3), Arg.Is(500), Arg.Any <IEnumerable <string> >())
            .Returns(feeds);

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            HttpRequest request = Substitute.For <HttpRequest>();

            //Act
            IActionResult result = await service.GetNotifications(3, "Published,Approved", null, request);

            //Assert
            result
            .Should()
            .BeOfType <NotFoundResult>();
        }
Пример #10
0
        public AllocationNotificationFeedsService(IAllocationNotificationsFeedsSearchService feedsService)
        {
            Guard.ArgumentNotNull(feedsService, nameof(feedsService));

            _feedsService = feedsService;
        }
Пример #11
0
 private static AllocationNotificationFeedsService CreateService(IAllocationNotificationsFeedsSearchService searchService = null)
 {
     return(new AllocationNotificationFeedsService(searchService ?? CreateSearchService()));
 }
Пример #12
0
        public async Task GetNotifications_GivenMajorMinorFeatureToggleOn_ReturnsMajorMinorVersionNumbers()
        {
            //Arrange
            SearchFeedV2 <AllocationNotificationFeedIndex> feeds = new SearchFeedV2 <AllocationNotificationFeedIndex>
            {
                PageRef    = 3,
                Top        = 500,
                TotalCount = 3,
                Entries    = CreateFeedIndexes()
            };

            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            feedsSearchService
            .GetFeedsV2(Arg.Is(3), Arg.Is(2))
            .ReturnsForAnyArgs(feeds);

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            IHeaderDictionary headerDictionary = new HeaderDictionary
            {
                { "Accept", new StringValues("application/json") }
            };

            IQueryCollection queryStringValues = new QueryCollection(new Dictionary <string, StringValues>
            {
                { "pageRef", new StringValues("3") },
                { "allocationStatuses", new StringValues("Published,Approved") },
                { "pageSize", new StringValues("2") }
            });

            HttpRequest request = Substitute.For <HttpRequest>();

            request.Scheme.Returns("https");
            request.Path.Returns(new PathString("/api/v1/test"));
            request.Host.Returns(new HostString("wherever.naf:12345"));
            request.QueryString.Returns(new QueryString("?pageRef=3&pageSize=2&allocationStatuses=Published,Approved"));
            request.Headers.Returns(headerDictionary);
            request.Query.Returns(queryStringValues);

            //Act
            IActionResult result = await service.GetNotifications(request, pageRef : 3, pageSize : 2, allocationStatuses : new[] { "Published", "Approved" });

            //Assert
            result
            .Should()
            .BeOfType <ContentResult>();

            ContentResult contentResult         = result as ContentResult;
            AtomFeed <AllocationModel> atomFeed = JsonConvert.DeserializeObject <AtomFeed <AllocationModel> >(contentResult.Content);

            atomFeed
            .Should()
            .NotBeNull();

            atomFeed.Id.Should().NotBeEmpty();
            atomFeed.AtomEntry.Count.Should().Be(3);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationMajorVersion.Should().Be(1);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationMinorVersion.Should().Be(0);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationMajorVersion.Should().Be(2);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationMinorVersion.Should().Be(0);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationMajorVersion.Should().Be(0);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationMinorVersion.Should().Be(3);
        }
Пример #13
0
        public async Task GetNotifications_GivenSearchFeedReturnsResultsButTitleIsBlank_EnsuresTitleGenerated()
        {
            //Arrange

            IEnumerable <AllocationNotificationFeedIndex> allocationNotificationFeeds = CreateFeedIndexes();

            allocationNotificationFeeds.First().Title = null;

            SearchFeed <AllocationNotificationFeedIndex> feeds = new SearchFeed <AllocationNotificationFeedIndex>
            {
                PageRef    = 3,
                Top        = 500,
                TotalCount = 3,
                Entries    = allocationNotificationFeeds
            };

            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            feedsSearchService
            .GetFeeds(Arg.Is(3), Arg.Is(2), Arg.Any <IEnumerable <string> >())
            .Returns(feeds);

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            IHeaderDictionary headerDictionary = new HeaderDictionary();

            headerDictionary.Add("Accept", new StringValues("application/json"));

            IQueryCollection queryStringValues = new QueryCollection(new Dictionary <string, StringValues>
            {
                { "pageRef", new StringValues("3") },
                { "allocationStatuses", new StringValues("Published,Approved") },
                { "pageSize", new StringValues("2") }
            });

            HttpRequest request = Substitute.For <HttpRequest>();

            request.Scheme.Returns("https");
            request.Path.Returns(new PathString("/api/v1/test"));
            request.Host.Returns(new HostString("wherever.naf:12345"));
            request.QueryString.Returns(new QueryString("?pageRef=3&pageSize=2&allocationStatuses=Published,Approved"));
            request.Headers.Returns(headerDictionary);
            request.Query.Returns(queryStringValues);

            //Act
            IActionResult result = await service.GetNotifications(3, "Published,Approved", 2, request);

            //Assert
            result
            .Should()
            .BeOfType <ContentResult>();

            ContentResult contentResult         = result as ContentResult;
            AtomFeed <AllocationModel> atomFeed = JsonConvert.DeserializeObject <AtomFeed <AllocationModel> >(contentResult.Content);

            atomFeed
            .Should()
            .NotBeNull();

            atomFeed.AtomEntry.ElementAt(0).Title.Should().Be("Allocation al 1 was Published");
        }
Пример #14
0
        public async Task GetNotifications_GivenSearchFeedReturnsNoResults_ReturnsAtomFeed()
        {
            //Arrange
            SearchFeed <AllocationNotificationFeedIndex> feeds = new SearchFeed <AllocationNotificationFeedIndex>
            {
                PageRef    = 3,
                Top        = 500,
                TotalCount = 3,
                Entries    = CreateFeedIndexes()
            };

            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            feedsSearchService
            .GetFeeds(Arg.Is(3), Arg.Is(2), Arg.Any <IEnumerable <string> >())
            .Returns(feeds);

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            IHeaderDictionary headerDictionary = new HeaderDictionary();

            headerDictionary.Add("Accept", new StringValues("application/json"));

            IQueryCollection queryStringValues = new QueryCollection(new Dictionary <string, StringValues>
            {
                { "pageRef", new StringValues("3") },
                { "allocationStatuses", new StringValues("Published,Approved") },
                { "pageSize", new StringValues("2") }
            });

            HttpRequest request = Substitute.For <HttpRequest>();

            request.Scheme.Returns("https");
            request.Path.Returns(new PathString("/api/v1/test"));
            request.Host.Returns(new HostString("wherever.naf:12345"));
            request.QueryString.Returns(new QueryString("?pageRef=3&pageSize=2&allocationStatuses=Published,Approved"));
            request.Headers.Returns(headerDictionary);
            request.Query.Returns(queryStringValues);

            //Act
            IActionResult result = await service.GetNotifications(3, "Published,Approved", 2, request);

            //Assert
            result
            .Should()
            .BeOfType <ContentResult>();

            ContentResult contentResult         = result as ContentResult;
            AtomFeed <AllocationModel> atomFeed = JsonConvert.DeserializeObject <AtomFeed <AllocationModel> >(contentResult.Content);

            atomFeed
            .Should()
            .NotBeNull();

            atomFeed.Id.Should().NotBeEmpty();
            atomFeed.Title.Should().Be("Calculate Funding Service Allocation Feed");
            atomFeed.Author.Name.Should().Be("Calculate Funding Service");
            atomFeed.Link.First(m => m.Rel == "self").Href.Should().Be("https://wherever.naf:12345/api/v1/notifications?pageRef=3&allocationStatuses=Published,Approved&pageSize=2");
            atomFeed.Link.First(m => m.Rel == "first").Href.Should().Be("https://wherever.naf:12345/api/v1/notifications?pageRef=1&allocationStatuses=Published,Approved&pageSize=2");
            atomFeed.Link.First(m => m.Rel == "last").Href.Should().Be("https://wherever.naf:12345/api/v1/notifications?pageRef=1&allocationStatuses=Published,Approved&pageSize=2");
            atomFeed.Link.First(m => m.Rel == "previous").Href.Should().Be("https://wherever.naf:12345/api/v1/notifications?pageRef=2&allocationStatuses=Published,Approved&pageSize=2");
            atomFeed.Link.First(m => m.Rel == "next").Href.Should().Be("https://wherever.naf:12345/api/v1/notifications?pageRef=3&allocationStatuses=Published,Approved&pageSize=2");
            atomFeed.AtomEntry.Count.Should().Be(3);
            atomFeed.AtomEntry.ElementAt(0).Id.Should().Be("id-1");
            atomFeed.AtomEntry.ElementAt(0).Title.Should().Be("test title 1");
            atomFeed.AtomEntry.ElementAt(0).Summary.Should().Be("test summary 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.Id.Should().Be("fs-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.Name.Should().Be("fs 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Period.Id.Should().Be("fp-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.UkPrn.Should().Be("1111");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.Upin.Should().Be("0001");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationLine.Id.Should().Be("al-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationLine.Name.Should().Be("al 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationVersionNumber.Should().Be(1);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationStatus.Should().Be("Published");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationAmount.Should().Be(10);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.ProfilePeriods.Length.Should().Be(0);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.ShortName.Should().Be("fs-short-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.Id.Should().Be("fspi-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.Name.Should().Be("fspi1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.StartDay.Should().Be(1);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.StartMonth.Should().Be(8);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.EndDay.Should().Be(31);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.EndMonth.Should().Be(7);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Period.Name.Should().Be("fspi1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Period.StartYear.Should().Be(2018);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Period.EndYear.Should().Be(2019);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.Name.Should().Be("provider 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.LegalName.Should().Be("legal 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.Urn.Should().Be("01");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.DfeEstablishmentNumber.Should().Be("dfe-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.EstablishmentNumber.Should().Be("e-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.LaCode.Should().Be("la-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.LocalAuthority.Should().Be("authority");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.Type.Should().Be("type 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.SubType.Should().Be("sub type 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.OpenDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.CloseDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.CrmAccountId.Should().Be("crm-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.NavVendorNo.Should().Be("nv-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.Status.Should().Be("Active");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationLine.ShortName.Should().Be("short-al1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationLine.FundingRoute.Should().Be("LA");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationLine.ContractRequired.Should().Be("Y");
            atomFeed.AtomEntry.ElementAt(1).Id.Should().Be("id-2");
            atomFeed.AtomEntry.ElementAt(1).Title.Should().Be("test title 2");
            atomFeed.AtomEntry.ElementAt(1).Summary.Should().Be("test summary 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.Id.Should().Be("fs-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.Name.Should().Be("fs 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Period.Id.Should().Be("fp-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.UkPrn.Should().Be("2222");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.Upin.Should().Be("0002");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationLine.Id.Should().Be("al-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationLine.Name.Should().Be("al 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationVersionNumber.Should().Be(1);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationStatus.Should().Be("Published");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationAmount.Should().Be(100);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.ProfilePeriods.Length.Should().Be(2);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.ShortName.Should().Be("fs-short-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.Id.Should().Be("fspi-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.Name.Should().Be("fspi2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.StartDay.Should().Be(1);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.StartMonth.Should().Be(8);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.EndDay.Should().Be(31);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.EndMonth.Should().Be(7);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Period.Name.Should().Be("fspi2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Period.StartYear.Should().Be(2018);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Period.EndYear.Should().Be(2019);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.Name.Should().Be("provider 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.LegalName.Should().Be("legal 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.Urn.Should().Be("02");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.DfeEstablishmentNumber.Should().Be("dfe-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.EstablishmentNumber.Should().Be("e-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.LaCode.Should().Be("la-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.LocalAuthority.Should().Be("authority");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.Type.Should().Be("type 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.SubType.Should().Be("sub type 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.OpenDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.CloseDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.CrmAccountId.Should().Be("crm-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.NavVendorNo.Should().Be("nv-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.Status.Should().Be("Active");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationLine.ShortName.Should().Be("short-al2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationLine.FundingRoute.Should().Be("LA");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationLine.ContractRequired.Should().Be("Y");
            atomFeed.AtomEntry.ElementAt(2).Id.Should().Be("id-3");
            atomFeed.AtomEntry.ElementAt(2).Title.Should().Be("test title 3");
            atomFeed.AtomEntry.ElementAt(2).Summary.Should().Be("test summary 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.Id.Should().Be("fs-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.Name.Should().Be("fs 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Period.Id.Should().Be("fp-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.UkPrn.Should().Be("3333");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.Upin.Should().Be("0003");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationLine.Id.Should().Be("al-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationLine.Name.Should().Be("al 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationVersionNumber.Should().Be(1);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationStatus.Should().Be("Approved");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationAmount.Should().Be(20);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.ProfilePeriods.Length.Should().Be(0);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.ShortName.Should().Be("fs-short-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.PeriodType.Id.Should().Be("fspi-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.PeriodType.StartDay.Should().Be(1);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.PeriodType.StartMonth.Should().Be(8);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.PeriodType.EndDay.Should().Be(31);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.PeriodType.EndMonth.Should().Be(7);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Period.Name.Should().Be("fspi3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Period.StartYear.Should().Be(2018);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Period.EndYear.Should().Be(2019);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.Name.Should().Be("provider 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.LegalName.Should().Be("legal 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.Urn.Should().Be("03");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.DfeEstablishmentNumber.Should().Be("dfe-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.EstablishmentNumber.Should().Be("e-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.LaCode.Should().Be("la-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.LocalAuthority.Should().Be("authority");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.Type.Should().Be("type 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.SubType.Should().Be("sub type 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.OpenDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.CloseDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.CrmAccountId.Should().Be("crm-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.NavVendorNo.Should().Be("nv-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.Status.Should().Be("Active");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationLine.ShortName.Should().Be("short-al3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationLine.FundingRoute.Should().Be("LA");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationLine.ContractRequired.Should().Be("Y");
        }
Пример #15
0
        public async Task GetNotifications_GivenAQueryStringForWhichThereAreResults_ReturnsAtomFeedWithCorrectLinks()
        {
            //Arrange
            SearchFeedV2 <AllocationNotificationFeedIndex> feeds = new SearchFeedV2 <AllocationNotificationFeedIndex>
            {
                PageRef    = 2,
                Top        = 2,
                TotalCount = 8,
                Entries    = CreateFeedIndexes()
            };
            AllocationNotificationFeedIndex firstFeedItem = feeds.Entries.ElementAt(0);

            firstFeedItem.VariationReasons = new[] { "LegalNameFieldUpdated", "LACodeFieldUpdated" };
            firstFeedItem.Successors       = new[] { "provider4" };
            firstFeedItem.Predecessors     = new[] { "provider1", "provider2" };
            firstFeedItem.OpenReason       = "Fresh Start";
            firstFeedItem.CloseReason      = "Closure";

            IAllocationNotificationsFeedsSearchService feedsSearchService = CreateSearchService();

            feedsSearchService
            .GetFeedsV2(Arg.Is(2), Arg.Is(2))
            .ReturnsForAnyArgs(feeds);

            AllocationNotificationFeedsService service = CreateService(feedsSearchService);

            IHeaderDictionary headerDictionary = new HeaderDictionary();

            headerDictionary.Add("Accept", new StringValues("application/json"));

            IQueryCollection queryStringValues = new QueryCollection(new Dictionary <string, StringValues>
            {
                { "pageRef", new StringValues("2") },
                { "allocationStatuses", new StringValues("Published,Approved") },
                { "pageSize", new StringValues("2") }
            });

            HttpRequest request = Substitute.For <HttpRequest>();

            request.Scheme.Returns("https");
            request.Path.Returns(new PathString("/api/v2/allocations/notifications"));
            request.Host.Returns(new HostString("wherever.naf:12345"));
            request.QueryString.Returns(new QueryString("?pageSize=2&allocationStatuses=Published&allocationStatuses=Approved"));
            request.Headers.Returns(headerDictionary);
            request.Query.Returns(queryStringValues);

            //Act
            IActionResult result = await service.GetNotifications(request, pageRef : 2, pageSize : 2, allocationStatuses : new[] { "Published", "Approved" });

            //Assert
            result
            .Should()
            .BeOfType <ContentResult>();

            ContentResult contentResult         = result as ContentResult;
            AtomFeed <AllocationModel> atomFeed = JsonConvert.DeserializeObject <AtomFeed <AllocationModel> >(contentResult.Content);

            atomFeed
            .Should()
            .NotBeNull();

            atomFeed.Id.Should().NotBeEmpty();
            atomFeed.Title.Should().Be("Calculate Funding Service Allocation Feed");
            atomFeed.Author.Name.Should().Be("Calculate Funding Service");
            atomFeed.Link.First(m => m.Rel == "next-archive").Href.Should().Be("https://wherever.naf:12345/api/v2/allocations/notifications/3?pageSize=2&allocationStatuses=Published&allocationStatuses=Approved");
            atomFeed.Link.First(m => m.Rel == "prev-archive").Href.Should().Be("https://wherever.naf:12345/api/v2/allocations/notifications/1?pageSize=2&allocationStatuses=Published&allocationStatuses=Approved");
            atomFeed.Link.First(m => m.Rel == "self").Href.Should().Be("https://wherever.naf:12345/api/v2/allocations/notifications?pageSize=2&allocationStatuses=Published&allocationStatuses=Approved");
            atomFeed.Link.First(m => m.Rel == "current").Href.Should().Be("https://wherever.naf:12345/api/v2/allocations/notifications/2?pageSize=2&allocationStatuses=Published&allocationStatuses=Approved");
            atomFeed.AtomEntry.Count.Should().Be(3);
            atomFeed.AtomEntry.ElementAt(0).Id.Should().Be("https://wherever.naf:12345/api/v2/allocations/id-1");
            atomFeed.AtomEntry.ElementAt(0).Title.Should().Be("test title 1");
            atomFeed.AtomEntry.ElementAt(0).Summary.Should().Be("test summary 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.Id.Should().Be("fs-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.Name.Should().Be("fs 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Period.Id.Should().Be("fp-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.UkPrn.Should().Be("1111");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.Upin.Should().Be("0001");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationLine.Id.Should().Be("al-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationLine.Name.Should().Be("al 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationStatus.Should().Be("Published");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationAmount.Should().Be(10);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.ProfilePeriods.Should().HaveCount(0);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.ShortName.Should().Be("fs-short-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.Id.Should().Be("fspi-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.Name.Should().Be("fspi1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.StartDay.Should().Be(1);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.StartMonth.Should().Be(8);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.EndDay.Should().Be(31);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.FundingStream.PeriodType.EndMonth.Should().Be(7);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Period.Name.Should().Be("fspi1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Period.StartYear.Should().Be(2018);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Period.EndYear.Should().Be(2019);
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.Name.Should().Be("provider 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.LegalName.Should().Be("legal 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.Urn.Should().Be("01");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.DfeEstablishmentNumber.Should().Be("dfe-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.EstablishmentNumber.Should().Be("e-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.LaCode.Should().Be("la-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.LocalAuthority.Should().Be("authority");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.Type.Should().Be("type 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.SubType.Should().Be("sub type 1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.OpenDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.CloseDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.CrmAccountId.Should().Be("crm-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.NavVendorNo.Should().Be("nv-1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.Status.Should().Be("Active");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationLine.ShortName.Should().Be("short-al1");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationLine.FundingRoute.Should().Be("LA");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationLine.ContractRequired.Should().Be("Y");
            atomFeed.AtomEntry.ElementAt(0).Content.Allocation.AllocationResultTitle.Should().Be("test title 1");
            ProviderVariation providerVariation1 = atomFeed.AtomEntry.ElementAt(0).Content.Allocation.Provider.ProviderVariation;

            providerVariation1.Should().NotBeNull();
            providerVariation1.VariationReasons.Should().BeEquivalentTo("LegalNameFieldUpdated", "LACodeFieldUpdated");
            providerVariation1.Successors.First().Ukprn.Should().Be("provider4");
            providerVariation1.Predecessors.First().Ukprn.Should().Be("provider1");
            providerVariation1.Predecessors[1].Ukprn.Should().Be("provider2");
            providerVariation1.OpenReason.Should().Be("Fresh Start");
            providerVariation1.CloseReason.Should().Be("Closure");

            atomFeed.AtomEntry.ElementAt(1).Id.Should().Be("https://wherever.naf:12345/api/v2/allocations/id-2");
            atomFeed.AtomEntry.ElementAt(1).Title.Should().Be("test title 2");
            atomFeed.AtomEntry.ElementAt(1).Summary.Should().Be("test summary 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.Id.Should().Be("fs-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.Name.Should().Be("fs 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Period.Id.Should().Be("fp-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.UkPrn.Should().Be("2222");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.Upin.Should().Be("0002");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationLine.Id.Should().Be("al-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationLine.Name.Should().Be("al 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationStatus.Should().Be("Published");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationAmount.Should().Be(100);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.ProfilePeriods.Should().HaveCount(2);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.ShortName.Should().Be("fs-short-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.Id.Should().Be("fspi-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.Name.Should().Be("fspi2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.StartDay.Should().Be(1);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.StartMonth.Should().Be(8);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.EndDay.Should().Be(31);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.FundingStream.PeriodType.EndMonth.Should().Be(7);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Period.Name.Should().Be("fspi2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Period.StartYear.Should().Be(2018);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Period.EndYear.Should().Be(2019);
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.Name.Should().Be("provider 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.LegalName.Should().Be("legal 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.Urn.Should().Be("02");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.DfeEstablishmentNumber.Should().Be("dfe-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.EstablishmentNumber.Should().Be("e-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.LaCode.Should().Be("la-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.LocalAuthority.Should().Be("authority");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.Type.Should().Be("type 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.SubType.Should().Be("sub type 2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.OpenDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.CloseDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.CrmAccountId.Should().Be("crm-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.NavVendorNo.Should().Be("nv-2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.Status.Should().Be("Active");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationLine.ShortName.Should().Be("short-al2");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationLine.FundingRoute.Should().Be("LA");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationLine.ContractRequired.Should().Be("Y");
            atomFeed.AtomEntry.ElementAt(1).Content.Allocation.AllocationResultTitle.Should().Be("test title 2");
            ProviderVariation providerVariation2 = atomFeed.AtomEntry.ElementAt(1).Content.Allocation.Provider.ProviderVariation;

            AssertProviderVariationValuesNotSet(providerVariation2);

            atomFeed.AtomEntry.ElementAt(2).Id.Should().Be("https://wherever.naf:12345/api/v2/allocations/id-3");
            atomFeed.AtomEntry.ElementAt(2).Title.Should().Be("test title 3");
            atomFeed.AtomEntry.ElementAt(2).Summary.Should().Be("test summary 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.Id.Should().Be("fs-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.Name.Should().Be("fs 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Period.Id.Should().Be("fp-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.UkPrn.Should().Be("3333");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.Upin.Should().Be("0003");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationLine.Id.Should().Be("al-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationLine.Name.Should().Be("al 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationStatus.Should().Be("Approved");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationAmount.Should().Be(20);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.ProfilePeriods.Should().HaveCount(0);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.ShortName.Should().Be("fs-short-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.PeriodType.Id.Should().Be("fspi-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.PeriodType.StartDay.Should().Be(1);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.PeriodType.StartMonth.Should().Be(8);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.PeriodType.EndDay.Should().Be(31);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.FundingStream.PeriodType.EndMonth.Should().Be(7);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Period.Name.Should().Be("fspi3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Period.StartYear.Should().Be(2018);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Period.EndYear.Should().Be(2019);
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.Name.Should().Be("provider 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.LegalName.Should().Be("legal 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.Urn.Should().Be("03");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.DfeEstablishmentNumber.Should().Be("dfe-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.EstablishmentNumber.Should().Be("e-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.LaCode.Should().Be("la-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.LocalAuthority.Should().Be("authority");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.Type.Should().Be("type 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.SubType.Should().Be("sub type 3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.OpenDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.CloseDate.Should().NotBeNull();
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.CrmAccountId.Should().Be("crm-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.NavVendorNo.Should().Be("nv-3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.Status.Should().Be("Active");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationLine.ShortName.Should().Be("short-al3");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationLine.FundingRoute.Should().Be("LA");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationLine.ContractRequired.Should().Be("Y");
            atomFeed.AtomEntry.ElementAt(2).Content.Allocation.AllocationResultTitle.Should().Be("test title 3");
            ProviderVariation providerVariation3 = atomFeed.AtomEntry.ElementAt(2).Content.Allocation.Provider.ProviderVariation;

            AssertProviderVariationValuesNotSet(providerVariation2);
        }
Пример #16
0
 private static AllocationNotificationFeedsService CreateService(IAllocationNotificationsFeedsSearchService searchService = null, IFeatureToggle featureToggle = null)
 {
     return(new AllocationNotificationFeedsService(searchService ?? CreateSearchService(), featureToggle ?? CreateFeatureToggle()));
 }
Пример #17
0
 public ProviderResultsService(IAllocationNotificationsFeedsSearchService feedsService, ILogger logger, IFeatureToggle featureToggle)
 {
     _feedsService  = feedsService;
     _logger        = logger;
     _featureToggle = featureToggle;
 }
 public AllocationNotificationFeedsService(IAllocationNotificationsFeedsSearchService feedsService, IFeatureToggle featureToggle)
 {
     _feedsService  = feedsService;
     _featureToggle = featureToggle;
 }