public void SetUp()
        {
            ClearDatabase();

            _user1 = new User
                {
                    Username = "******",
                    Password = "******",
                    LastLoginDate = new DateTime(2011, 1, 2, 3, 4, 5),
                };

            _user1.AddReview(new Review
                {
                    Title = "Review 1 title",
                    Body = "Review 1 body",
                    DateTime = new DateTime(2011, 2, 3, 4, 5, 6),
                    Rating = 5
                });

            _user1.AddReview(new Review
                {
                    Title = "Review 2 title",
                    Body = "Review 2 body",
                    DateTime = new DateTime(2011, 2, 3, 6, 7, 8),
                    Rating = 4
                });

            _repository = new AdoUserRepository();
        }
        public void SetUp()
        {
            DataDeleter.ClearDatabase();

            _user1 = new User
                {
                    Username = "******",
                    Password = "******",
                    LastLoginDate = new DateTime(2011, 1, 2, 3, 4, 5),
                };

            _user2 = new User
                {
                    Username = "******",
                    Password = "******",
                    LastLoginDate = new DateTime(2011, 2, 2, 3, 4, 5),
                };

            _user3 = new User
                {
                    Username = "******",
                    Password = "******",
                    LastLoginDate = new DateTime(2011, 3, 3, 3, 4, 5),
                };

            _user4 = new User
                {
                    Username = "******",
                    Password = "******",
                    LastLoginDate = new DateTime(2011, 4, 4, 4, 4, 5),
                };

            _user1.AddReview(new Review
                {
                    Title = "User 1's first review",
                    Body = "This is the first review written by User 1",
                    DateTime = new DateTime(2011, 2, 3, 4, 5, 6),
                    Rating = 5
                });

            _user1.AddReview(new Review
                {
                    Title = "User 1's second review",
                    Body = "This is the second review written by User 1",
                    DateTime = new DateTime(2011, 2, 3, 6, 7, 8),
                    Rating = 4
                });

            _user2.AddReview(new Review
                {
                    Title = "User 2's first review",
                    Body = "This is the first review written by User 2",
                    DateTime = new DateTime(2011, 2, 4, 5, 6, 7),
                    Rating = 3
                });

            _user3.AddReview(new Review
                {
                    Title = "User 3's first review",
                    Body = "This is the first review written by User 3",
                    DateTime = new DateTime(2011, 2, 5, 6, 7, 8),
                    Rating = 5
                });

            _user3.AddReview(new Review
                {
                    Title = "User 3's second review",
                    Body = "This is the second review written by User 3",
                    DateTime = new DateTime(2011, 2, 5, 7, 8, 9),
                    Rating = 5
                });

            SaveAllUsers();

            _repository = new UserRepository();
        }
        private static void CreateTestData()
        {
            using (var session = SessionFactorySingleton.OpenSession())
            using (var transaction = session.BeginTransaction())
            {
                var user1 = new User
                    {
                        Username = "******",
                        Password = "******",
                        LastLoginDate = new DateTime(2011, 1, 2, 3, 4, 5),
                    };

                var user2 = new User
                    {
                        Username = "******",
                        Password = "******",
                        LastLoginDate = new DateTime(2022, 2, 2, 3, 4, 5),
                    };

                var user3 = new User
                    {
                        Username = "******",
                        Password = "******",
                        LastLoginDate = new DateTime(3033, 3, 3, 3, 4, 5),
                    };

                user1.AddReview(new Review
                    {
                        Title = "User 1's first review",
                        Body = "This is the first review written by User 1",
                        DateTime = new DateTime(2011, 2, 3, 4, 5, 6),
                        Rating = 5
                    });

                user1.AddReview(new Review
                    {
                        Title = "User 1's second review",
                        Body = "This is the second review written by User 1",
                        DateTime = new DateTime(2011, 2, 3, 6, 7, 8),
                        Rating = 4
                    });

                user2.AddReview(new Review
                    {
                        Title = "User 2's first review",
                        Body = "This is the first review written by User 2",
                        DateTime = new DateTime(2011, 2, 4, 5, 6, 7),
                        Rating = 5
                    });

                user2.AddReview(new Review
                    {
                        Title = "User 2's second review",
                        Body = "This is the second review written by User 2",
                        DateTime = new DateTime(2022, 2, 4, 6, 7, 8),
                        Rating = 4
                    });

                user2.AddReview(new Review
                    {
                        Title = "User 2's third review",
                        Body = "This is the third review written by User 2",
                        DateTime = new DateTime(2022, 2, 4, 7, 8, 9),
                        Rating = 3
                    });

                user3.AddReview(new Review
                    {
                        Title = "User 3's first review",
                        Body = "This is the first review written by User 3",
                        DateTime = new DateTime(3011, 3, 4, 5, 6, 7),
                        Rating = 1
                    });

                session.Save(user1);
                session.Save(user2);
                session.Save(user3);

                transaction.Commit();
            }
        }