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); }
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); }
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); }
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); }
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); }