Ejemplo n.º 1
0
        public void RemoveMessageItemAndPreview()
        {
            const int messageItemId = 62;
            var campaignService = new Mock<ICampaignService>();
            var controller = new CampaignController(campaignService.Object, null, null, null, null, ServiceBuilder.Saver.Object);
            var messageItem = new MessageItemBuilder().WithId(messageItemId).Build();

            campaignService.Expect(cs => cs.RetrieveMessageItemById(messageItemId))
                .Returns(messageItem);
            campaignService.Expect(cs => cs.MarkMessageItemForDeletion(messageItem));

            var result = (RedirectToRouteResult)controller.RemoveMessageItemAndPreview(messageItemId, 1);
            AssertRedirectToRoute(result, "Preview");
            campaignService.VerifyAll();
        }