public void UsingDataUtilityToBuildSessionFactory()
        {
            var factory = DataUtility.CreateSessionFactory(typeof(FooRecord), typeof(BarRecord));

            var session = factory.OpenSession();
            var foo1 = new FooRecord { Name = "world" };
            session.Save(foo1);
            session.Close();

            session = factory.OpenSession();
            var foo2 = session.CreateCriteria<FooRecord>()
                .Add(Restrictions.Eq("Name", "world"))
                .List<FooRecord>().Single();
            session.Close();

            Assert.That(foo1, Is.Not.SameAs(foo2));
            Assert.That(foo1.Id, Is.EqualTo(foo2.Id));
        }
        public void SqlServerSchemaShouldBeGeneratedAndUsable()
        {
            var recordDescriptors = new[] {
                                              new RecordBlueprint {TableName = "Hello", Type = typeof (FooRecord)}
                                          };

            ProviderUtilities.RunWithSqlServer(recordDescriptors,
                sessionFactory => {
                    var session = sessionFactory.OpenSession();
                    var foo = new FooRecord { Name = "hi there" };
                    session.Save(foo);
                    session.Flush();
                    session.Close();

                    Assert.That(foo, Is.Not.EqualTo(0));

                });
        }
        public void RepositoryCanCreateFetchAndDelete()
        {
            var foo1 = new FooRecord { Name = "yadda" };
            _fooRepos.Create(foo1);

            var foo2 = _fooRepos.Get(foo1.Id);
            foo2.Name = "blah";

            Assert.That(foo1, Is.SameAs(foo2));

            _fooRepos.Delete(foo2);
        }