public void Sync_To_Wordpress()
        {
            WordpressService.Arrange(ws => ws.SyncToWordpress(Post));

            Target.Create(Post);

            WordpressService.Assert(ws => ws.SyncToWordpress(Post), Occurs.Once());
        }
        public void Return_Same_View_When_Model_State_Is_Invalid()
        {
            WordpressService.Arrange(wps => wps.SyncToWordpress(Arg.IsAny <BlogPost>())).Throws <MissingAuthorException>();

            var result = Target.Edit(new BlogPostEditViewModel(Post, Context)) as ViewResult;

            result.ShouldNotBeNull();
        }
        public void Add_Model_Error_For_Wordpress_Author_When_Sync_Throws_MissingAuthorException()
        {
            WordpressService.Arrange(wps => wps.SyncToWordpress(Arg.IsAny <BlogPost>())).Throws <MissingAuthorException>();

            Target.Edit(new BlogPostEditViewModel(Post, Context));

            Target.ModelState["Post.AuthorId"].Errors.First().ErrorMessage.ShouldBe("Author not in Wordpress.");
        }
        public void Authorize_Wordpress()
        {
            WordpressService.Arrange(ws => ws.AuthorizeUser(Arg.AnyString));

            Target.Edit(new BlogPostEditViewModel(Post, Context));

            WordpressService.Assert(ws => ws.AuthorizeUser(Arg.AnyString));
        }
        public void Sync_To_Wordpress()
        {
            WordpressService.Arrange(ws => ws.SyncToWordpress(Post));

            Target.Edit(new BlogPostEditViewModel(Post, Context));

            WordpressService.Assert(ws => ws.SyncToWordpress(Post), Occurs.Once());
        }
Esempio n. 6
0
        public void Delete_Draft_From_Wordpress()
        {
            WordpressService.Arrange(ws => ws.DeleteFromWordpress(Arg.IsAny <BlogPost>()));

            Target.Delete(PostId);

            WordpressService.Assert(ws => ws.DeleteFromWordpress(Post));
        }
Esempio n. 7
0
        public void Authorize_In_Wordpress()
        {
            WordpressService.Arrange(ws => ws.AuthorizeUser(Arg.AnyString));

            Target.Delete(PostId);

            WordpressService.Assert(ws => ws.AuthorizeUser(Arg.AnyString));
        }
Esempio n. 8
0
        public void Authorize_Wordpress()
        {
            WordpressService.Arrange(ws => ws.AuthorizeUser(Arg.AnyString));
            WordpressService.Arrange(wps => wps.GetBlogPostById(Post.WordpressId)).Returns(Post);

            Target.Review(Post.Id);

            WordpressService.Assert(ws => ws.AuthorizeUser(Arg.AnyString));
        }
        public void Only_Sync_To_Wordpress_When_Post_Has_WordpressId()
        {
            WordpressService.Arrange(ws => ws.SyncToWordpress(Post));

            Post.WordpressId = 0;

            Target.Edit(new BlogPostEditViewModel(Post, Context));

            WordpressService.Assert(ws => ws.SyncToWordpress(Post), Occurs.Never());
        }
Esempio n. 10
0
        public void BeforeEachTest()
        {
            WordpressService.Arrange(ws => ws.AuthorizeUser(Arg.AnyString));
            WordpressService.Arrange(wps => wps.GetBlogPostById(Post.WordpressId)).Returns(Post);

            Context.BlogPosts.Add(Post);

            Target = new BlogPostsController(Context, Mock.Create <WritingCalendarService>(), WordpressService)
            {
                MapPath = "Doesn't matter"
            };
        }