public void Next_Returns_Valid_Object()
        {
            var session = AutoPocoContainer.CreateDefaultSession();
            var user    = session.Next <SimpleUser>();

            Assert.NotNull(user, "User was not created");
            Assert.NotNull(user.FirstName, "User did not get first name");
        }
        public void With_No_Config_Least_Greedy_Constructor_With_Default_Conventions_Is_Used_By_Default()
        {
            mSession = AutoPocoContainer.CreateDefaultSession();

            var result = mSession.Next <SimpleCtorClass>();

            Assert.NotNull(result.ReadOnlyProperty);
            Assert.Null(result.SecondaryProperty);
        }
        public void Next_WithNumber_Returns_Collection_Of_Valid_Objects()
        {
            var session = AutoPocoContainer.CreateDefaultSession();
            var users   = session.Collection <SimpleUser>(10).ToList();

            users.ForEach(x =>
            {
                Assert.NotNull(x, "User was not created");
                Assert.NotNull(x.FirstName, "User did not get first name");
            });
        }
        public void Next_WithAction_Allows_Configuration_Of_Object()
        {
            var session = AutoPocoContainer.CreateDefaultSession();
            var user    = session.Next <SimpleUser>(all =>
            {
                all.Impose(x => x.FirstName, "Scott");
                all.Impose(x => x.LastName, "Hanselman");
            });

            Assert.AreEqual("Scott", user.FirstName);
            Assert.AreEqual("Hanselman", user.LastName);
        }
        public void Next_WithAction_And_Number_Allows_Configuration_Of_Objects()
        {
            var session = AutoPocoContainer.CreateDefaultSession();
            var users   = session.Collection <SimpleUser>(10, all =>
            {
                all.Random(5)
                .Impose(x => x.FirstName, "Rob")
                .Next(5)
                .Impose(x => x.FirstName, "Scott");

                all.Random(5)
                .Impose(x => x.LastName, "Red")
                .Next(5)
                .Impose(x => x.LastName, "Blue");
            }).ToList();

            Assert.AreEqual(5, users.Count(x => x.FirstName == "Rob"));
            Assert.AreEqual(5, users.Count(x => x.FirstName == "Scott"));
            Assert.AreEqual(5, users.Count(x => x.LastName == "Red"));
            Assert.AreEqual(5, users.Count(x => x.LastName == "Blue"));
        }
 public void SetupTest()
 {
     mGenerationSession = AutoPocoContainer.CreateDefaultSession();
 }