public void BadHeaderId_ReturnsNothing() { // arrange int headerId = 5; ICatalogCampaignHeaderRepository repo = MakeRepo(); // act CatalogCampaignHeader header = repo.GetHeader(headerId); // assert header.Should() .BeNull(); }
public void GoodHeaderId_ReturnsExpectedEndDate() { // arrange DateTime expected = new DateTime(2030, 7, 3, 16, 9, 0, DateTimeKind.Unspecified); int headerId = 1; ICatalogCampaignHeaderRepository repo = MakeRepo(); // act CatalogCampaignHeader header = repo.GetHeader(headerId); // assert header.EndDate .Should() .Be(expected); }
public void GoodHeaderId_ReturnsExpectedDescription() { // arrange string expected = "Description1"; int headerId = 1; ICatalogCampaignHeaderRepository repo = MakeRepo(); // act CatalogCampaignHeader header = repo.GetHeader(headerId); // assert header.Description .Should() .Be(expected); }
public void GoodHeaderId_ReturnsExpectedActive() { // arrange bool expected = true; int headerId = 1; ICatalogCampaignHeaderRepository repo = MakeRepo(); // act CatalogCampaignHeader header = repo.GetHeader(headerId); // assert header.Active .Should() .Be(expected); }
public void GoodHeaderId_ReturnsExpectedId() { // arrange int expected = 1; int headerId = 1; ICatalogCampaignHeaderRepository repo = MakeRepo(); // act CatalogCampaignHeader header = repo.GetHeader(headerId); // assert header.Id .Should() .Be(expected); }
public CatalogCampaignReturnModel GetCampaign(int id, bool includeItems = true) { CatalogCampaignReturnModel campaign = new CatalogCampaignReturnModel(); var header = _campaignHeaderRepo.GetHeader(id); if (header != null) { campaign = header.ToModel(BEKConfiguration.CatalogCampaignImagesUrl); if (includeItems) { campaign.Items = _campaignItemRepo.GetByCampaign(id); } } else { throw new KeyNotFoundException("A catalog campaign header was not found for id " + id); } return(campaign); }