コード例 #1
0
        public void ToEmail_Internal_CheckFormatExceptions()
        {
            // Arrange
            var inputMail = new ecn.communicator.mvc.Models.Email();

            inputMail.Birthdate      = SampleDummy;
            inputMail.UserEvent1Date = SampleDummy;
            inputMail.UserEvent2Date = SampleDummy;
            var inputUser = new KMPlatform.Entity.User();

            ShimEmail.GetByEmailIDInt32User = (p1, p2) => new Email();

            // Act
            try
            {
                var internalEmail = ConversionMethods.ToEmail_Internal(inputMail, inputUser);

                // Assert
                internalEmail.ShouldBeNull();
            }
            catch (ECNException ex)
            {
                ex.ErrorList.ShouldNotBeNull();
                ex.ErrorList.Count.ShouldBe(4);
                ex.ErrorList[0].ErrorMessage.ShouldBe(ExceptionMessageFormatBirthdate);
                ex.ErrorList[1].ErrorMessage.ShouldBe(ExceptionMessageFormatUserEvent1Date);
                ex.ErrorList[2].ErrorMessage.ShouldBe(ExceptionMessageFormatUserEvent2Date);
                ex.ErrorList[3].ErrorMessage.ShouldBe(ExceptionMessageEmailRequired);
            }
        }
コード例 #2
0
        private void SetupForMethodIndex()
        {
            _appSettings = new NameValueCollection
            {
                [AdminNotify]         = AdminNotifyValue,
                [UsePatchForDouble]   = UsePatchForDoubleValue,
                [ECNEngineAccessKey]  = ECNEngineAccessKeyValue,
                [ValidateB4Tracking]  = _validateB4TrackingValue,
                [KmCommonApplication] = KmCommonApplicationValue
            };
            ShimConfigurationManager.AppSettingsGet = () => _appSettings;
            _runtimeCache    = new Cache();
            _user            = new EntityUser();
            _serverVariables = new NameValueCollection()
            {
                { VariableHttpUrl, $"clicks/{_queryString}" },
                { HttpHost, TestUrl }
            };
            _request.Setup(x => x.ServerVariables).
            Returns(_serverVariables);
            _request.Setup(x => x.UserHostAddress).
            Returns(TestUrl);
            _request.Setup(x => x.UserAgent).
            Returns(DummyString);
            _request.Setup(x => x.RawUrl).
            Returns(DummyString);
            _request.Setup(x => x.UrlReferrer).
            Returns(new Uri(TestUrl));
            _request.Setup(x => x.Headers).
            Returns(new NameValueCollection {
                { DummyString, DummyString }
            });
            ShimHttpRuntime.CacheGet = () => _runtimeCache;
            BusinessFakes.ShimUser.GetByAccessKeyStringBoolean = (x, y) => _user;
            var blastLink = ReflectionHelper.CreateInstance(typeof(BlastLink));

            blastLink.LinkURL = _linkUrl;
            ShimBlastLink.GetByBlastLinkIDInt32Int32 = (x, y) => blastLink;
            var blastRegular = ReflectionHelper.CreateInstance(typeof(BlastRegular));

            blastRegular.BlastType = "LAYOUT";
            ShimBlast.GetByBlastID_NoAccessCheckInt32Boolean      = (x, y) => blastRegular;
            ShimEmailGroup.ValidForTrackingInt32Int32             = (x, y) => true;
            ShimEmailDataValues.RecordTopicsValueInt32Int32String = (x, y, z) => 0;
            ShimLinkTracking.GetByCampaignItemIDInt32             = (x) => new List <LinkTracking> {
                ReflectionHelper.CreateInstance(typeof(LinkTracking))
            };
            ShimLinkTracking.CreateLinkTrackingParamsInt32StringInt32 = (x, y, z) => true;
            var paramInfoTable = new DataTable();

            paramInfoTable.Columns.Add(DummyString);
            paramInfoTable.Rows.Add(DummyString);
            ShimCampaignItemLinkTracking.GetParamInfoInt32Int32 = (x, y) => paramInfoTable;
            ShimIndexController.AllInstances.CreateTrackingLinkDataTableBoolean     = (x, y, z) => DummyString;
            ShimBaseChannel.HasProductFeatureInt32EnumsServicesEnumsServiceFeatures = (a, b, c) => true;
            ShimBlastActivity.FilterEmailsAllWithSmartSegmentInt32Int32             = (x, y) => paramInfoTable;
            ShimDomainTracker.ExistsStringInt32 = (x, y) => true;
        }
コード例 #3
0
        public void ToEmail_Internal_CheckOneToOne_NoException()
        {
            // Arrange
            var inputMail = CreateSampleEmail();
            var inputUser = new KMPlatform.Entity.User();

            ShimEmail.GetByEmailIDInt32User = (p1, p2) => new Email();

            // Act
            var internalEmail = ConversionMethods.ToEmail_Internal(inputMail, inputUser);

            // Assert
            internalEmail.ShouldNotBeNull();
            CheckInternalEmail(internalEmail);
        }
コード例 #4
0
        public void ToEmail_Internal_CheckEmptyMail_NoException()
        {
            // Arrange
            var inputMail = new ecn.communicator.mvc.Models.Email();

            inputMail.EmailAddress = SampleEmailAddress;
            inputMail.EmailID      = SampleEmailId;
            var inputUser = new KMPlatform.Entity.User();

            ShimEmail.GetByEmailIDInt32User = (p1, p2) => new Email();

            // Act
            var internalEmail = ConversionMethods.ToEmail_Internal(inputMail, inputUser);

            // Assert
            internalEmail.ShouldNotBeNull();
        }