Beispiel #1
0
        public void PushEmail_UpdateEmailFails_WarnWithMessage()
        {
            // ARRANGE
            var fakeEmailItem = Sub_EmailItem();

            fakeEmailItem.Exact_Target_External_Key = 77;

            var fakeUpdateResponse = new ExactTargetResponse
            {
                ExactTargetEmailId = 77,
                Success            = false,
                Message            = "nobody had fun!"
            };

            _dependencies.ExactTargetWrapper.UpdateEmail(Arg.Any <ET_Email>()).Returns(fakeUpdateResponse);

            _dependencies.SitecoreUrlWrapper.GetItemUrl(fakeEmailItem).Returns("http://Mooseville.com/emails/MeetTheMoose");
            _dependencies.WebClientWrapper.DownloadString("http://Mooseville.com/emails/MeetTheMoose")
            .Returns("<div><h1>Moose Update!</h1></div>");

            _dependencies.Premailer.InlineCss(Arg.Any <string>()).Returns(x => x.Arg <string>());

            // ACT
            _exactTargetClient.PushEmail(fakeEmailItem);

            // ASSERT
            _dependencies.LogWrapper.Received().SitecoreWarn(Arg.Is <string>(s => s.Contains("nobody had fun!")));
        }
Beispiel #2
0
        public void GetEmailHtml_DownloadStringHasContent_CssInlinerIsCalled()
        {
            // ARRANGE
            var fakeEmailItem = Sub_EmailItem();

            fakeEmailItem.Exact_Target_External_Key = 77;

            var fakeUpdateResponse = new ExactTargetResponse
            {
                ExactTargetEmailId = 77,
                Success            = false,
                Message            = "nobody had fun!"
            };

            _dependencies.SitecoreUrlWrapper.GetItemUrl(fakeEmailItem)
            .Returns("http://Mooseville.com/emails/MeetTheMoose");

            _dependencies.WebClientWrapper.DownloadString("http://Mooseville.com/emails/MeetTheMoose")
            .Returns("<div><h1>Moose Update!</h1></div>");

            // ACT
            _exactTargetClient.GetEmailHtml(fakeEmailItem);

            // ASSERT
            _dependencies.Premailer.Received().InlineCss(Arg.Is <string>(s => s.Contains("Moose Update")));
        }
Beispiel #3
0
        public void PushEmail_EmailItemHasETEmailId_CallUpdateEmail()
        {
            // ARRANGE
            var fakeEmailItem = Sub_EmailItem();

            fakeEmailItem.Exact_Target_External_Key = 77;

            var fakeUpdateResponse = new ExactTargetResponse
            {
                ExactTargetEmailId = 77,
                Success            = true,
                Message            = "fun was had by all"
            };

            _dependencies.ExactTargetWrapper.UpdateEmail(Arg.Any <ET_Email>()).Returns(fakeUpdateResponse);
            _dependencies.SitecoreUrlWrapper.GetItemUrl(fakeEmailItem)
            .Returns("http://Mooseville.com/emails/MeetTheMoose");
            _dependencies.Premailer.InlineCss(Arg.Any <string>()).Returns(x => x.Arg <string>());

            _dependencies.WebClientWrapper.DownloadString("http://Mooseville.com/emails/MeetTheMoose")
            .Returns("<div><h1>Moose Update!</h1></div>");

            // ACT
            _exactTargetClient.PushEmail(fakeEmailItem);

            // ASSERT
            _dependencies.ExactTargetWrapper.Received(1)
            .UpdateEmail(Arg.Is <ET_Email>(email => email.HTMLBody == "<div><h1>Moose Update!</h1></div>"));
        }
Beispiel #4
0
        private void Sub_CreateResult()
        {
            var fakeCreateResponse = new ExactTargetResponse
            {
                ExactTargetEmailId = 101,
                Success            = true,
                Message            = "fun was had by all"
            };

            _dependencies.ExactTargetWrapper.CreateEmail(Arg.Any <ET_Email>()).Returns(fakeCreateResponse);
        }