NOODB: Nulls

NOODB now saves null references. A future rule can be to prevent this, but not today. Today, we just want to save nulls.


                // show that null works - AUTHOR and MOVIE
                MovieReview fromDb = client.GetObjects<MovieReview>()[0];
                Assert.AreEqual("Greetings", fromDb.Comments);
                Assert.AreEqual(id, fromDb.Id);
                Assert.AreEqual(5, review.Rating);

                // now set the references
                fromDb.Author = new Author { Name = "bogus", Title = "bogus2" };
                fromDb.Movie = new Movie { Director = "Director", Name = "movie" };

                // the reference is no longer null
                MovieReview fromDb2 = client.GetObjects<MovieReview>()[0];
                Assert.AreEqual("bogus", fromDb2.Author.Name);
                Assert.AreEqual("bogus2", fromDb2.Author.Title);
                Assert.AreEqual("Director", fromDb2.Movie.Director);
                Assert.AreEqual("movie", fromDb2.Movie.Name);

I have another test that’s the opposite of this; starts off with a reference, and then is nulled out.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: