public void SaveCampaignItem_smartsegment_WhenValidCampaignItem_SavesRelatedEntities() { // Arrange CampaignItem campaignItem = GetCampaignItem(); var parentCI = GetCampaignItem(); parentCI.SendTime = parentCI.SendTime.Value.AddDays(-1); var campaignId = 1; SetPageControls(); SetGvSelectedGroupsGrid(); SetGvSuppressedGroupsGrid(); SetFakesForSaveCampaignItem(); // Act var isSaved = _testEntity.saveCampaignItem_smartsegment(campaignItem, parentCI, campaignId); // Assert isSaved.ShouldSatisfyAllConditions( () => isSaved.ShouldBeTrue(), () => _isBlastCreated.ShouldBeTrue(), () => _isBlastLitRefDeleted.ShouldBeTrue(), () => _isCampaignItemBlastSaved.ShouldBeTrue(), () => _isCampaignItemSaved.ShouldBeTrue(), () => _isCampaignSuppressionDeleted.ShouldBeTrue(), () => _isCampaignSuppressionSaved.ShouldBeTrue(), () => _savedCampaignItemBlast.ShouldNotBeNull(), () => _savedCampaignItem.ShouldNotBeNull(), () => _savedCampaignSuppresseion.ShouldNotBeNull(), () => _deletedBlastRefId.Count.ShouldBe(1), () => _deletedBlastRefId.ShouldContain(-1), () => _deletedSuppressionCamapaignId.ShouldBe(-1)); }
public void Save_WhenCheckLosingCampaignChecked_SavesRelatedEntities(CampaignItem campaignItem) { // Arrange const string deliveredOrOpened = "TestString"; InitializePageAndControls(); SetupFakesIfEmptyWinnerType(deliveredOrOpened); SetFakesForSaveMethod(); SetPageViewState(); Get <CheckBox>(_privateControlObj, ChkAorB).Checked = true; Get <CheckBox>(_privateControlObj, ChkLosingCampaign).Checked = true; ShimCampaignItem.GetByCampaignItemID_NoAccessCheckInt32Boolean = (id, child) => campaignItem; // Act var isSaved = _control.Save(); // Assert isSaved.ShouldSatisfyAllConditions( () => isSaved.ShouldBeTrue(), () => _isBlastCreated.ShouldBeTrue(), () => _isCampaignItemSaved.ShouldBeTrue(), () => _isSampleSaved.ShouldBeTrue(), () => _deletedCampaignItemBlastID.ShouldBe(campaignItem.BlastList.Any() ? campaignItem.BlastList[0].CampaignItemBlastID : 0), () => _deletedCampaignItemId.ShouldBe(0), () => _savedCampaignItemBlast.ShouldNotBeNull(), () => _savedCampaignItems.ShouldNotBeEmpty(), () => _savedCampaignItems.Count.ShouldBe(2), () => _savedCampaignItemSuppression.ShouldNotBeNull(), () => _savedCampaignItemSuppression.ShouldNotBeEmpty(), () => _savedCampaignItemSuppression.Count.ShouldBe(1), () => _savedSample.ShouldNotBeNull()); }