コード例 #1
0
            public void GoodUri_ReturnsExpectedHasFilter()
            {
                // arrange
                string uri = "uri-1";
                ICatalogCampaignHeaderRepository repo = MakeRepo();
                var expected = true;

                // act
                CatalogCampaignHeader header = repo.GetByUri(uri);

                // assert
                header.HasFilter
                .Should()
                .Be(expected);
            }
コード例 #2
0
            public void GoodUri_ReturnsExpectedUri()
            {
                // arrange
                string expected = "uri-1";
                string uri      = "uri-1";
                ICatalogCampaignHeaderRepository repo = MakeRepo();

                // act
                CatalogCampaignHeader header = repo.GetByUri(expected);

                // assert
                header.Uri
                .Should()
                .Be(expected);
            }
コード例 #3
0
            public void GoodUri_ReturnsExpectedActive()
            {
                // arrange
                bool   expected = true;
                string uri      = "uri-1";
                ICatalogCampaignHeaderRepository repo = MakeRepo();

                // act
                CatalogCampaignHeader header = repo.GetByUri(uri);

                // assert
                header.Active
                .Should()
                .Be(expected);
            }
コード例 #4
0
            public void GoodUri_ReturnsExpectedStartDate()
            {
                // arrange
                DateTime expected = new DateTime(2017, 7, 3, 16, 8, 0, DateTimeKind.Unspecified);
                string   uri      = "uri-1";
                ICatalogCampaignHeaderRepository repo = MakeRepo();

                // act
                CatalogCampaignHeader header = repo.GetByUri(uri);

                // assert
                header.StartDate
                .Should()
                .Be(expected);
            }
コード例 #5
0
        public CatalogCampaignReturnModel GetCampaignByUri(string uri, bool includeItems = true)
        {
            CatalogCampaignReturnModel campaign = new CatalogCampaignReturnModel();

            var header = _campaignHeaderRepo.GetByUri(uri);

            if (header != null)
            {
                campaign = header.ToModel(BEKConfiguration.CatalogCampaignImagesUrl);

                if (includeItems)
                {
                    campaign.Items = _campaignItemRepo.GetByCampaign(campaign.Id);
                }
            }
            else
            {
                throw new KeyNotFoundException("A catalog campaign header was not found for id " + campaign.Id);
            }

            return(campaign);
        }