コード例 #1
0
ファイル: PostServices.cs プロジェクト: ignu/tribality
        public void Save(BlogPost blogPost)
        {
            Check.NotNull(blogPost, "Post Can not Be Null");
            Check.NotNull(blogPost.Owner, "Post Owner must be specified");

            if (String.IsNullOrEmpty(blogPost.PrettyUrl))
                blogPost.PrettyUrl = getUniqueUrl(blogPost);

            blogPostRepository.Save(blogPost);
            blogPostRepository.Flush();
        }
コード例 #2
0
 public override void establish_context()
 {
     blogPost = new BlogPost { Body = "This is new test", Subject = "Hello", Owner = owner};
     postServices.Expect(p => p.Save(blogPost)).Callback(() => blogPost.ID = 1);
     base.establish_context();
 }
コード例 #3
0
ファイル: PostController.cs プロジェクト: ignu/tribality
 public ViewResult Save(BlogPost blogPost)
 {
     postServices.Save(blogPost);
     return View("Message", GetMasterPageName(), "Post Saved");
 }
コード例 #4
0
ファイル: PostServices.cs プロジェクト: ignu/tribality
        private string getUniqueUrl(BlogPost blogPost)
        {
            string url = blogPost.Subject.ToUrl();

            if (postDoesNotExist(url))
                url += "-" + blogPost.Owner.UserName;

            while (postDoesNotExist(url))
            {
                url += "-1";
            }
            return url;
        }
コード例 #5
0
ファイル: LoadData.cs プロジェクト: ignu/tribality
        public void can_save_post()
        {
            IBlogPostRepository repository = Container.Resolve<IBlogPostRepository>();
            repository.Clear();
            BlogPost blogPost = new BlogPost { Subject = "The Managed Extensibility Framework",
                                   Body = "Microsoft Managed Extensibility (MEF) framework allows developers to add “hooks” into their application to make it extensible at runtime. These hooks allow you or a third party to extend your application dynamically in the future. In this session, we will review the MEF tool set and build an extensible application and then extend that application using MEF. ",
                                   PrettyUrl = "the-managed-extensibility-framework"
            };
            repository.Save(blogPost);
            repository.Flush();
            blogPost.ID.ShouldBeGreaterThan(0);

            blogPost = new BlogPost { Body = "In a confusing world of soylent green, flying saucers, and collapsing markets, Parallel FX is coming. Come where its still safe: technology land and learn to parallelize your LINQ queries. Its cool. Its happening, and its hygenic. .",
                Subject = "Programming with Parallel LINQ",
                                      PrettyUrl = "programming-with-parallel-linq"
            };
            repository.Save(blogPost);

            blogPost = new BlogPost
            {
                Body = "Your small web application has grown into a monster. Manual testing is not cutting it anymore, and you are looking for ideas on how to apply automated testing to an existing application. This session will explain concepts and tools used in testing web applications. ",
                Subject = "Testing for the Web",
                PrettyUrl = "testing-for-the-web"
            };
            repository.Save(blogPost);

            repository.Flush();
        }
コード例 #6
0
 public override void establish_context()
 {
     user = new User("ignu", "*****@*****.**");
     post = new BlogPost {PrettyUrl = "what-now"};
     binder = Create<CommentBinder>();
 }