Beispiel #1
0
        public void CanRetrieveBusinessObject()
        {
            using (var uow = UoWFactory.Create())
            {
                #region Arrange

                var rep = uow.Create();
                var blog = new Blog
                {
                    Name = Fixture.Create<string>()
                };

                var createdBlog = rep.Add<Blog>(blog);

                uow.Commit();

                #endregion Arrange

                #region Act

                //var retrievedBlog = rep.RetrieveById<Blog>(createdBlog.Id);

                #endregion Act

                #region Assert

                // TODO

                #endregion Assert
            }
        }
        public void CanPerformWhat()
        {
            //Assert.Inconclusive("This is unintuative!!");
            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                var blog = Fixture.Build <Blog>()
                           .OmitAutoProperties()
                           .With(p => p.Name, Fixture.Create <string>())
                           .Create();

                rep.Add(blog);

                var post = Fixture.Build <Post>()
                           .OmitAutoProperties()
                           .With(p => p.Url, Guid.NewGuid().ToString())
                           .With(p => p.Text, Fixture.Create <string>())
                           .Create();

                blog.Posts.Add(post);

                rep.AddWithRelations(blog);

                // The post will not be added to repository here, since blog entity is tracked by the first add
                // above. The AddWithRelations method used the TrackEntity method, which in turn stops traversing
                // the graph.

                uow.Commit();
            }
        }
        public void CanAddWithRelations()
        {
            #region Arrange

            var blog = new Blog();
            blog.Name = Fixture.Create <string>();

            var post = new Post();
            post.Text = Fixture.Create <string>();
            post.Url  = Guid.NewGuid().ToString();
            blog.Posts.Add(post);

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var repository = uow.Create();

                var updatedBlog = repository.AddWithRelations(blog);
                uow.Commit();
            }

            #endregion Act

            #region Assert

            // TODO!

            #endregion Assert
        }
Beispiel #4
0
        public void CanRetrieve()
        {
            List<Blog> blogs = new List<Blog>()
            {
                new Blog()
                {
                    Author = Fixture.Create<string>(),
                    Description = Fixture.Create<string>(),
                    Name = Fixture.Create<string>()
                }
            };
            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                rep.Add(blogs.ToArray());

                uow.Commit();
            }

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                var retrievedTwo = rep.RetrieveById<Blog>(blogs[0].Id, b => b.Posts, b => b.Followers);

                var builder = rep.NavigationPropertySelectorBuilder<Blog>()
                    .Include(b => b.Posts);
                    
                var retrievedOne = rep.RetrieveById<Blog>(blogs[0].Id, builder.Build());
                
            }


        }
 /// <summary>
 /// Egy adott felhasználóhoz tartozó órarend megjelenítése
 /// </summary>
 /// <param name="userId">A felhasználó azonosítója</param>
 /// <returns>A megfelelő TimeTable objektumokat tartalmazó lista</returns>
 public async Task <IEnumerable <TimeTable> > ListTimeTablesForUserAsync(string userId)
 {
     using (var uow = UoWFactory.Create())
     {
         return(await uow.TimeTableRepository.ListAsync(n => n.UserId == userId));
     }
 }
Beispiel #6
0
        public void CanRetrieveBusinessObjectDiconnected()
        {
            Blog createdBlog = null;

            #region Arrange

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();
                var blog = new Blog
                {
                    Name = Fixture.Create<string>()
                };

                createdBlog = rep.Add<Blog>(blog);

                uow.Commit();
            }

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();
                //var retrievedBlog = rep.Retrieve<Blog>(createdBlog.Id);
            }

            #endregion Act
        }
Beispiel #7
0
        public void CanAddBusinessObject()
        {
            #region Arrange

            var blog = new Blog
            {
                Name = Fixture.Create <string>()
            };

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                var persistedBlog = rep.Add <Blog>(blog);

                uow.Commit();
            }

            #endregion Act

            #region Assert

            // TODO.

            #endregion Assert
        }
Beispiel #8
0
        public void CanAddAnotherBusinessObject()
        {
            #region Arrange

            Post post;

            post      = new Post();
            post.Text = Fixture.Create <string>();
            post.Date = Fixture.Create <string>();
            post.Url  = Guid.NewGuid().ToString();

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var rep          = uow.Create();
                var persitedPost = rep.Add <Post>(post);

                uow.Commit();
            }

            #endregion Act

            #region Assert

            // TODO.

            #endregion Assert
        }
Beispiel #9
0
            public void CanRetrieve235()
            {
                Blog blog          = null;
                Blog retrievedBlog = null;

                using (var uow = UoWFactory.Create())
                {
                    var repository = uow.Create();

                    blog = Fixture.Create <Blog>();

                    repository.AddWithRelations(blog);

                    uow.Commit();

                    var newFollower = Fixture.Create <Follower>();
                    newFollower.Name = "NewName";
                    newFollower.Blog = blog;
                    blog.Followers.Add(newFollower);

                    repository.Add <Follower>(newFollower);
                    uow.Commit();
                }
                using (var uow = UoWFactory.Create())
                {
                    var repository = uow.Create();

                    var pp4 = repository.PropertySelectBuilder <Blog>(blog)
                              .Select()
                              .Include <Follower>(b => b.Followers, b => b.Id, b => b.Name)
                              .Build();

                    retrievedBlog = repository.RetrieveById(blog.Id, pp4);
                }
            }
Beispiel #10
0
 public void Excluir(Conta entidade)
 {
     using (var uow = UoWFactory.Create())
     {
         contaRepositorio.Excluir(entidade);
         uow.Commit();
     }
 }
Beispiel #11
0
 public void Excluir(Transacoes entidade)
 {
     using (var uow = UoWFactory.Create())
     {
         transacoesRepositorio.Excluir(entidade);
         uow.Commit();
     }
 }
Beispiel #12
0
            public void CanRetrieveById()
            {
                var blog = new Blog();

                blog.Name = Fixture.Create <string>();
                using (var uow = UoWFactory.Create())
                {
                    var repository = uow.Create();

                    var createdBlog = repository.Add(blog);

                    uow.Commit();
                }

                var post = new Post();

                post.Text = Fixture.Create <string>();
                post.Url  = Guid.NewGuid().ToString();

                using (var uow = UoWFactory.Create())
                {
                    var repository = uow.Create();

                    var updatedBlog = repository.Add(post);

                    uow.Commit();
                }

                var newPost = new Post();

                newPost.Text = Fixture.Create <string>();
                newPost.Url  = Guid.NewGuid().ToString();
                blog.Posts.AddRange(new List <Post>()
                {
                    newPost, post
                });

                using (var uow = UoWFactory.Create())
                {
                    var repository = uow.Create();

                    var updatedBlog = repository.UpdateGraph(blog);

                    uow.Commit();
                }

                using (var uow = UoWFactory.Create())
                {
                    var repository = uow.Create();

                    var pp = repository.PropertySelectBuilder(blog)
                             .Select(m => m.Name)
                             .Include <Post>(p => p.Posts, p => p.Text)
                             .Build();

                    var retrievedBlogWithPosts = repository.RetrieveById(blog.Id, pp);
                }
            }
Beispiel #13
0
        static void Main(string[] args)
        {
            PreRegistration prereg;

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();
                prereg       = new PreRegistration();
                prereg.Text  = "First pre registration";
                prereg.Text1 = "Additional text";

                var k = rep.Create <PreRegistration>(prereg);



                uow.Commit();
            }

            var meeting = new Meeting();

            meeting.Location = "Location 1";
            prereg.Text      = "Update preregistratioon text";
            prereg.Meeting   = meeting;
            meeting.PreRegistrations.Add(prereg);

            var prereg1 = new PreRegistration();

            prereg1.Text    = "New pre registratoob";
            prereg1.Meeting = meeting;
            meeting.PreRegistrations.Add(prereg1);

            using (var uow = UoWFactory.Create())
            {
                var repository = uow.Create();

                var updatedMeeting = repository.UpdateGraph(meeting);
                uow.Commit();
            }

            //meeting.PreRegistrations.AddRange(new List<PreRegistration>() { prereg, prereg1 });
            //using (var uow = UoWFactory.Create())
            //{
            //    context.ChangeTracker.AttachGraph(meeting);
            //    prereg1.Text1 = "lkjalkjslkjslkjslkjlsj";
            //    meeting.PreRegistrations.Remove(prereg1);

            //    context.SaveChanges();
            //}

            //using (var context = new EF7BloggContext())
            //{
            //    context.Remove(prereg1);

            //    context.SaveChanges();
            //}
        }
Beispiel #14
0
        public void CanRetrieveOrderBy()
        {
            #region Arrange

            string name = Fixture.Create<string>();
            List<Blog> blogs = new List<Blog>()
            {
                new Blog()
                {
                    Author = "Adam",
                    Description = Fixture.Create<string>(),
                    Name = name,
                },
                new Blog()
                {
                    Author = "Bertil",
                    Description = Fixture.Create<string>(),
                    Name = name,
                },
                new Blog()
                {
                    Author = "Cescar",
                    Description = Fixture.Create<string>(),
                    Name = name,
                }
            };

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                rep.Add(blogs.ToArray());

                uow.Commit();
            }

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                var retrieved = rep.Retrieve<Blog>(predicate => predicate.Name == name, order => order.Author).ToList();
            }

            #endregion Act
        }
Beispiel #15
0
        public void CanRetrieveBlogNonGeneric()
        {
            #region Arrange

            Blog createdBlog;
            Post post;
            using (var uow = UoWFactory.Create())
            {
                var rep  = uow.Create();
                var blog = new Blog
                {
                    Name = Fixture.Create <string>()
                };

                post      = new Post();
                post.Text = Fixture.Create <string>();
                post.Date = Fixture.Create <string>();
                post.Url  = Guid.NewGuid().ToString();
                post.Blog = blog;

                blog.Posts.Add(post);

                createdBlog = rep.AddWithRelations(blog);

                uow.Commit();
            }

            #endregion Arrange

            #region Act

            Blog retrievedBlog = null;
            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();
                retrievedBlog = rep.RetrieveBlogNonGeneric(createdBlog.Id);
            }

            #endregion Act

            #region Assert

            Assert.IsNotNull(retrievedBlog);

            #endregion Assert
        }
        public void CanCreate6()
        {
            var blog = new Blog();

            blog.Name = Fixture.Create <string>();
            using (var uow = UoWFactory.Create())
            {
                var repository = uow.Create();

                var persistedBlog = repository.Add(blog);

                uow.Commit();
            }

            var post = new Post();

            post.Text = Fixture.Create <string>();
            post.Url  = Guid.NewGuid().ToString();

            using (var uow = UoWFactory.Create())
            {
                var repository = uow.Create();

                var persistedPost = repository.Add(post);

                uow.Commit();
            }

            var post1 = new Post();

            post1.Text = Fixture.Create <string>();
            post1.Url  = Guid.NewGuid().ToString();
            blog.Posts.AddRange(new List <Post>()
            {
                post, post1
            });

            using (var uow = UoWFactory.Create())
            {
                var repository = uow.Create();

                var updatedBlog = repository.UpdateGraph(blog);

                uow.Commit();
            }
        }
        public void CanAddWithRelations_Inconclusive()
        {
            Assert.Inconclusive("This implementation of retrieve is not going to be used");
            Post post;
            Blog createdBlog;

            using (var uow = UoWFactory.Create())
            {
                var rep  = uow.Create();
                var blog = new Blog
                {
                    Name = Fixture.Create <string>()
                };

                post      = new Post();
                post.Text = Fixture.Create <string>();
                post.Date = Fixture.Create <string>();
                post.Url  = Guid.NewGuid().ToString();
                post.Blog = blog;

                blog.Posts.Add(post);

                post      = new Post();
                post.Text = Fixture.Create <string>();
                post.Date = Fixture.Create <string>();
                post.Url  = Guid.NewGuid().ToString();
                post.Blog = blog;

                blog.Posts.Add(post);

                createdBlog = rep.AddWithRelations(blog);

                uow.Commit();
            }

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                var retrievedBlogWithPosts = rep.RetrieveObsolete <Blog, dynamic>(
                    createdBlog.Id, p => new { ff = p.Name, ffff = p.Description, fff = p.Posts.Select(pp => pp.Text) });
            }
        }
Beispiel #18
0
        public void CanUpdateBusinessObject()
        {
            #region Arrange

            Post retrievedPost = null;
            using (var uow = UoWFactory.Create())
            {
                Post post;
                var  rep = uow.Create();
                post      = new Post();
                post.Text = Fixture.Create <string>();
                post.Date = Fixture.Create <string>();
                post.Url  = Guid.NewGuid().ToString();

                var persistedPost = rep.Add <Post>(post);

                uow.Commit();

                var projector = rep.PropertySelectBuilder(post)
                                .Select(p => p.Text, p => p.Date)
                                .Build();

                retrievedPost = rep.RetrieveById(persistedPost.Id, projector);
            }

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();
                retrievedPost.Text = Fixture.Create <string>();
                retrievedPost.Date = Fixture.Create <string>();

                rep.Update(retrievedPost, p => p.Text);

                uow.Commit();
            }

            #endregion Act
        }
Beispiel #19
0
        public void CanRetrieveBusinessObjectSelectedIntProperty()
        {
            #region Arrange

            Blog createdBlog;

            var blog = new Blog
            {
                Name = Fixture.Create<string>(),
                Description = Fixture.Create<string>()
            };

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                createdBlog = rep.Add(blog);

                uow.Commit();
            }

            #endregion Act

            #region Assert

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                var projector = rep.PropertySelectBuilder(blog)
                    .Select(p => p.Id)
                    .Build();

                var retrievedBlog = rep.RetrieveById(createdBlog.Id, projector);
            }

            #endregion Assert
        }
Beispiel #20
0
        public void CanUpdateSelectedProperties()
        {
            #region Arrange

            var blog = new Blog();
            blog.Name = Fixture.Create <string>();
            using (var uow = UoWFactory.Create())
            {
                var repository = uow.Create();

                var updatedBlog = repository.UpdateGraph(blog);

                uow.Commit();
            }

            #endregion Arrange

            #region Act

            blog.Name   = Fixture.Create <string>();
            blog.Author = Fixture.Create <string>();

            using (var uow1 = UoWFactory.Create())
            {
                var repository = uow1.Create();

                // Only name should be updated
                var updatedBlog = repository.Update(blog, p => p.Name);

                uow1.Commit();
            }

            #endregion Act

            #region Assert

            var uow2 = UoWFactory.Create();
            var r    = uow2.Create();

            #endregion Assert
        }
Beispiel #21
0
            public void CanWhatUnintuitiveBehavior()
            {
                Blog blog          = null;
                Blog retrievedBlog = null;

                using (var uow = UoWFactory.Create())
                {
                    var repository = uow.Create();

                    blog = Fixture.Create <Blog>();

                    repository.AddWithRelations(blog);

                    uow.Commit();

                    var newFollower = Fixture.Create <Follower>();
                    newFollower.Blog = blog;
                    blog.Followers.Add(newFollower);

                    repository.Add <Follower>(newFollower);

                    uow.Commit();

                    var pp4 = repository.PropertySelectBuilder <Blog>(blog)
                              .Select()
                              .Include <Follower>(b => b.Followers, pp11 => pp11.Id, pp11 => pp11.Name)
                              .Build();

                    retrievedBlog = repository.RetrieveById(blog.Id, pp4);
                }

                #region Assert

                // TODO: Don't know how to fix this, maybe when an object with a certain type and specific id is fetched from db, it should be
                // untracked by context.
                Assert.Inconclusive("Don't know how to fix this, maybe when an object with a certain type and specific id is fetched from");
                Assert.AreEqual(blog.Followers.Count, retrievedBlog.Followers.Count);

                #endregion Assert
            }
Beispiel #22
0
        public void CanRetrieveByIdSelectedPropertiesFromBusinessObject()
        {
            using (var uow = UoWFactory.Create())
            {
                #region Arrange

                var rep = uow.Create();
                var blog = new Blog
                {
                    Name = Fixture.Create<string>(),
                    Posts = new List<Post>()
                    {
                        new Post() { Text =  Fixture.Create<string>(), Url = Fixture.Create<string>()}
                    }
                };

                var createdBlog = rep.AddWithRelations(blog);

                uow.Commit();

                #endregion Arrange

                #region Act

                var projector = rep.PropertySelectBuilder(blog)
                    .Select(p => p.Name)
                    .Include<Post>(m => m.Posts, p => p.Url)
                    .Build();

                var retrievedBlog = rep.RetrieveById<Blog>(createdBlog.Id, projector);

                #endregion Act

                #region Assert

                // TODO

                #endregion Assert
            }
        }
Beispiel #23
0
        public void CanAddTheSameBusinessObjectExpectedException()
        {
            /*
             * This test should fail since the alternate key Url value is the same between the two insterts.
             */

            #region Arrange

            Post post;

            post      = new Post();
            post.Text = Fixture.Create <string>();
            post.Date = Fixture.Create <string>();
            post.Url  = Guid.NewGuid().ToString();

            using (var uow = UoWFactory.Create())
            {
                var rep          = uow.Create();
                var persitedPost = rep.Add <Post>(post);

                uow.Commit();

                #endregion Arrange

                #region Act

                persitedPost = rep.Add <Post>(post);

                uow.Commit();

                #endregion Act
            }

            #region Assert

            // TODO.

            #endregion Assert
        }
Beispiel #24
0
        public void CanAddTheSameBusinessObjectUsingDisconnectedScenarioExpectedException()
        {
            #region Arrange

            Post post;

            post      = new Post();
            post.Text = Fixture.Create <string>();
            post.Date = Fixture.Create <string>();
            post.Url  = Guid.NewGuid().ToString();

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();
                var persitedPreRegistration = rep.Add <Post>(post);

                uow.Commit();
            }

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var rep          = uow.Create();
                var persitedPost = rep.Add <Post>(post);

                uow.Commit();
            }

            #endregion Act

            #region Assert

            // TODO.

            #endregion Assert
        }
        public void CanCreate5()
        {
            var blog = new Blog();

            blog.Name = Fixture.Create <string>();
            using (var uow = UoWFactory.Create())
            {
                var repository = uow.Create();

                var updatedBlog = repository.UpdateGraph(blog);

                uow.Commit();
            }

            var post = new Post();

            post.Text = Fixture.Create <string>();
            post.Url  = Guid.NewGuid().ToString();

            using (var uow = UoWFactory.Create())
            {
                var repository = uow.Create();

                var updatedBlog = repository.UpdateGraph(post);

                uow.Commit();
            }

            blog.Posts.Add(post);

            using (var uow = UoWFactory.Create())
            {
                var repository = uow.Create();

                var updatedBlog = repository.UpdateGraph(blog);

                uow.Commit();
            }
        }
Beispiel #26
0
        public void CanAddManyBusinessObjectWithoutRoundtrips()
        {
            #region Arrange

            var blog1 = new Blog()
            {
                Name = Fixture.Create <string>()
            };
            var blog2 = new Blog()
            {
                Name = Fixture.Create <string>()
            };
            var blog3 = new Blog()
            {
                Name = Fixture.Create <string>()
            };

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                // This will generate one batch sql command to the database.
                var persistedBlog = rep.Add <Blog>(new[] { blog1, blog2, blog3 });

                uow.Commit();
            }

            #endregion Act

            #region Assert

            // TODO

            #endregion Assert
        }
Beispiel #27
0
        public void CanDoTest()
        {
            //Assert.Inconclusive("This test fails due to invalid test key generation. Running thsi test together with all test, will make it fail due to same key wih different type in cache already");
            // This test fails due to invalid test key generation. Running thsi test together with all test, will make it fail due to same key wih different type in cache already
            Blog blog = Fixture.Create <Blog>();

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                rep.AddWithRelations(blog);

                uow.Commit();
            }

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                var retrievedBlog = rep.RetrieveById(blog.Id,
                                                     rep.PropertySelectBuilder(blog)
                                                     .Select(p => p.Name)
                                                     .Build());
            }

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                var retrievedBlog = rep.RetrieveById(
                    blog.Id,
                    rep.PropertySelectBuilder(blog)
                    .Select(p => p.Name)
                    .Include <Post>(p => p.Posts, p => p.Text)
                    .Include <Follower>(p => p.Followers, prop => prop.Name)
                    .Build());
            }
        }
Beispiel #28
0
            public void MyTestMethod()
            {
                using (var uow = UoWFactory.Create())
                {
                    var repository = uow.Create();

                    var blog = Fixture.Create <Blog>();

                    repository.AddWithRelations(blog);

                    uow.Commit();

                    blog.Posts[0].Text = "New text";

                    var pp1 = repository.PropertyUpdateBuilder <Blog>(blog)
                              .IncludeNavigationProperyUpdate <Post>(
                        blog.Posts[0].Id,
                        p => p.Posts,
                        p => p.Text)
                              .Build();

                    var updatedBlog = repository.UpdateGraph(blog, pp1);
                };
            }
        public void CanAddParentWithRelationsWhenSomePartsInGraphAlreadyAddedToRepository()
        {
            /*
             * 1. Create a blog, and add it to the repository. The parent object is added to repository (IsKeySet on entity will become true)
             * 2. Using a different contect add a post (navigation property entity) to the blog and add it to the repository.
             */

            #region Arrange

            Blog createdBlog;
            Post post;

            var blog = Fixture.Build <Blog>()
                       .OmitAutoProperties()
                       .With(p => p.Name, Fixture.Create <string>())
                       .Create();

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                rep.AddWithRelations(blog);

                uow.Commit();
            }

            post = Fixture.Create <Post>();

            blog.Posts.Add(post);

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                createdBlog = rep.AddWithRelations(blog);

                uow.Commit();
            }

            #endregion Act

            #region Assert

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                var pp = rep.PropertySelectBuilder(blog)
                         .Select(m => m.Id, m => m.Name, m => m.Description)
                         .Include <Post>(p => p.Posts, p => p.Text, p => post.Date)
                         .Include <Follower>(m => m.Followers, p => p.Id, p => p.Name)
                         .Build();

                var retrievedBlog = rep.RetrieveById(createdBlog.Id, pp);
            }

            #endregion Assert
        }
        public void CanAddWithRelations2()
        {
            #region Arrange

            Blog createdBlog;
            Post post;

            var blog = new Blog
            {
                Name        = Fixture.Create <string>(),
                Description = Fixture.Create <string>()
            };

            post = new Post()
            {
                Text = Fixture.Create <string>(),
                Date = Fixture.Create <string>(),
                Url  = Guid.NewGuid().ToString(),
                Blog = blog,
            };

            var follower = new Follower()
            {
                Name = Fixture.Create <string>(),
                Blog = blog
            };

            blog.Posts.Add(post);
            blog.Followers.Add(follower);

            post      = new Post();
            post.Text = Fixture.Create <string>();
            post.Date = Fixture.Create <string>();
            post.Url  = Guid.NewGuid().ToString();
            post.Blog = blog;

            blog.Posts.Add(post);

            #endregion Arrange

            #region Act

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                createdBlog = rep.AddWithRelations(blog);

                uow.Commit();
            }

            #endregion Act

            #region Assert

            using (var uow = UoWFactory.Create())
            {
                var rep = uow.Create();

                var pp = rep.PropertySelectBuilder(blog)
                         .Select(m => m.Id, m => m.Name, m => m.Description)
                         .Include <Post>(p => p.Posts, p => p.Text, p => post.Date)
                         .Include <Follower>(m => m.Followers, p => p.Id, p => p.Name)
                         .Build();

                var retrievedBlog = rep.RetrieveById(createdBlog.Id, pp);
            }

            #endregion Assert
        }