Exemplo n.º 1
0
        public void Can_find_post_by_id()
        {
            var ws = new InMemWorkspace();

            using (var context = GetDomainContext(ws))
            {
                var postAboutAOP = new Post();
                postAboutAOP.Edit("AOP for dummies", "...");
                ws.Add(postAboutAOP);

                ws.ClearUoW();

                //auto inc id's are not good for tests... get id "0"
                Post foundPost = context.Posts.FindById(0);

                Assert.IsTrue(foundPost != null);
            }
        }
Exemplo n.º 2
0
        public void Can_remove_post()
        {
            var ws = new InMemWorkspace();

            using (var context = GetDomainContext(ws))
            {
                var post = new Post();
                post.Edit("AOP for dummies", "...");
                post.Publish();

                ws.Add(post);
                ws.ClearUoW();

                Assert.AreEqual(0, ws.GetRemovedEntityCount <Post>());

                post = context.Posts.FindById(0);
                context.Posts.Remove(post);

                Assert.AreEqual(1, ws.GetRemovedEntityCount <Post>());
            }
        }
Exemplo n.º 3
0
        public void Can_remove_post()
        {
            var ws = new InMemWorkspace();
            using(var context = GetDomainContext(ws))
            {
                
                var post = new Post();
                post.Edit("AOP for dummies", "...");
                post.Publish();

                ws.Add(post);
                ws.ClearUoW();

                Assert.AreEqual(0, ws.GetRemovedEntityCount<Post>());

                post = context.Posts.FindById(0);
                context.Posts.Remove(post);

                Assert.AreEqual(1, ws.GetRemovedEntityCount<Post>());
            }
        }
Exemplo n.º 4
0
        public void Can_find_post_by_id()
        {
            var ws = new InMemWorkspace();
            using (var context = GetDomainContext(ws))
            {
                
                var postAboutAOP = new Post();
                postAboutAOP.Edit("AOP for dummies", "...");
                ws.Add(postAboutAOP);

                ws.ClearUoW();

                //auto inc id's are not good for tests... get id "0"
                Post foundPost = context.Posts.FindById(0);

                Assert.IsTrue(foundPost != null);
            }
        }