コード例 #1
0
        public void IsUniqueTimeoutExpiredBug()
        {
            ActiveRecordStarter.Initialize(GetConfigSource(), typeof(Blog2), typeof(Blog5));
            Recreate();

            for (int i = 0; i < 5; i++)
            {
                Blog5 blog = new Blog5();
                blog.Name = "A cool blog";
                blog.Create();
            }

            Blog5 theBlog = new Blog5();

            theBlog.Name = "A cool blog";
            theBlog.Create();

            Blog5 anotherBlog = new Blog5();

            anotherBlog.Name = "A cool blog";
            anotherBlog.Create();

            anotherBlog.Name = "A very cool blog";
            anotherBlog.Update();

            Assert.IsFalse(Blog2.Find(theBlog.Id).IsValid());

            Blog2 weblog = new Blog2();

            weblog.Name = theBlog.Name;

            Assert.IsFalse(weblog.IsValid());

            weblog.Create();
        }
コード例 #2
0
        public void IsUniqueWithSessionScope()
        {
            ActiveRecordStarter.Initialize(GetConfigSource(), typeof(Blog2));
            Recreate();

            Blog2.DeleteAll();

            Blog2 blog = new Blog2();

            blog.Name = "hammett";
            blog.Create();

            using (new SessionScope())
            {
                Blog2 fromDb = Blog2.Find(blog.Id);
                fromDb.Name = "foo";
                fromDb.Save();
            }
        }