public async Task ApplyCampaignDiscountTest() { List <CampaignDTO> campaignList = new List <CampaignDTO>() { _mapper.Map <CampaignDTO>(MockModels.MockCampaignModel()), _mapper.Map <CampaignDTO>(MockModels.MockCampaignModel()) }; double discountAmount = await cart.ApplyCampaignDiscountAsync(_cartDTO, campaignList); Assert.Positive(discountAmount); }
public async Task CreateCampaignTest() { int campaignID = await campaign.CreateCampaignAsync(_mapper.Map <CampaignDTO>(MockModels.MockCampaignModel())); Assert.AreEqual(campaignID, MockModels.MockCampaignModel().CampaignId); }
public void Setup() { campaignEFServiceMock = new Mock <ICampaignEFService>(); campaignEFServiceMock.Setup(c => c.AddCampaignAsync(It.IsAny <CampaignModel>())).Returns(Task.FromResult(MockModels.MockCampaignModel().CampaignId)); var mapperConfig = new MapperConfiguration(cfg => { cfg.AddProfile(new MapperProfile()); }); _mapper = mapperConfig.CreateMapper(); campaign = new Campaign(_mapper, campaignEFServiceMock.Object); }