public void CreateEmailList_WhenhasEmailPreviewIsTrue_CreateCustomerEmailTestFromEngineIsCalled(bool testBlast)
        {
            // Arrage
            Initialize();
            CreateShims("CreateEmailList");
            _testBlast = testBlast;
            var emailPreviewCreated = false;

            ShimDataFunctions.ExecuteScalarString = (sqlQuery) => 1;
            ShimPreview.AllInstances.CreateCustomerEmailTestFromEngineInt32Int32 = (x, y, z) =>
            {
                emailPreviewCreated = true;
                return("sample String");
            };
            ShimPreview.GetSpamSeedAddresses = () =>
            {
                var sampleStringArr = new string[]
                {
                    "sampleString1",
                    "sampleString2",
                };
                return(sampleStringArr);
            };

            //Act
            var emailList = EmailFunctions.CreateEmailList(_blast, _bounceDomain, _testBlast);

            //Assert
            emailPreviewCreated.ShouldBeTrue();
        }
        public void CreateEmailList_WhenStoredProcedureEmailListCountReturnsRows_EmailListIsCreated(bool testBlast)
        {
            // Arrage
            Initialize();
            CreateShims("CreateEmailList");
            _testBlast = testBlast;
            var dummyCellValue = "dummy Cell Value";

            ShimDbDataAdapter.AllInstances.FillDataSetString = (x, dataset, z) =>
            {
                dataset.Tables.Add(FillDataSetDummyTable("dummyColumn", dummyCellValue));
                return(0);
            };

            //Act
            var emailList = EmailFunctions.CreateEmailList(_blast, _bounceDomain, _testBlast);

            //Assert
            emailList.ShouldSatisfyAllConditions(
                () => emailList.ShouldNotBeNull(),
                () => emailList.Rows.ShouldNotBeNull(),
                () => emailList.Rows[0].ItemArray.ShouldNotBeNull(),
                () => emailList.Rows[0].ItemArray.ShouldNotBeEmpty(),
                () =>
            {
                var resultCellValue = emailList.Rows[0].ItemArray[0];
                resultCellValue.ShouldBe(dummyCellValue);
            });
        }
        public void CreateEmailList_XmlDocumentHaveEmailAddressNode_EmailListContainsTheseNodes(bool testBlast)
        {
            // Arrage
            Initialize();
            CreateShims("CreateEmailList");
            _testBlast = testBlast;
            ShimXmlNode.AllInstances.SelectSingleNodeString = (x, y) => DummyXmlNode();

            //Act
            var emailList = EmailFunctions.CreateEmailList(_blast, _bounceDomain, _testBlast);

            //Assert
            var dummyTableRowCount     = GetDataTableDummyTable().Rows.Count;
            var emailListRowCount      = emailList.Rows.Count;
            var emailListContainsNodes = emailListRowCount > dummyTableRowCount ? true : false;

            emailListContainsNodes.ShouldBeTrue();
        }
        public void CreateEmailList_CommunicatorTableContainsSeedsForCustomer_EmailListContainsTheseSeeds(bool testBlast)
        {
            // Arrage
            Initialize();
            CreateShims("CreateEmailList");
            _testBlast = testBlast;
            ShimDataFunctions.GetDataTableStringSqlCommand = (x, y) => GetDataTableDummyTable();

            //Act
            var emailList = EmailFunctions.CreateEmailList(_blast, _bounceDomain, _testBlast);

            //Assert
            var dummyTableRowCount     = GetDataTableDummyTable().Rows.Count;
            var emailListRowCount      = emailList.Rows.Count;
            var emailListContainsSeeds = emailListRowCount > dummyTableRowCount;

            emailListContainsSeeds.ShouldBeTrue();
        }
        public void CreateEmailList_WhenTestBlastIsSet_GetByBlastIDIsCalledOrNot(bool testBlast, bool isCalledGetByBlastID)
        {
            // Arrage
            Initialize();
            CreateShims("CreateEmailList");
            _blast.BlastType = "Personalization";
            _testBlast       = testBlast;
            var _isCalledGetByBlastID = false;

            ShimCampaignItem.GetByBlastID_NoAccessCheckInt32Boolean = (x, y) =>
            {
                _isCalledGetByBlastID = true;
                return(new CampaignItem());
            };

            //Act
            EmailFunctions.CreateEmailList(_blast, _bounceDomain, _testBlast);

            //Assert
            _isCalledGetByBlastID.ShouldBe(isCalledGetByBlastID);
        }