public void SingleFieldAssocitationValidation()
        {
            NorthwindObjectContext context = new LocalNorthwindObjectContext();

            // RegionID = 0 is invalid
            context.Territories.AddObject(
                new Territory()
                {
                    TerritoryID = "0000",
                    TerritoryDescription = "New territory",
                    RegionID = 0
                });

            try
            {
                // The new region addition must fail
                context.SaveChanges();

                Assert.Fail();
            }
            catch (Exception ex)
            {
                // Search for ForeignKeyViolationException exception
                Assert.IsTrue(
                    ExceptionHelper.ContainsException(
                        ex,
                        "NMemory.Exceptions.ForeignKeyViolationException"));
            }
        }
        public void SingleFieldAssocitationEmpty()
        {
            NorthwindObjectContext context = new LocalNorthwindObjectContext();

            // All field is empty, null foreign keys
            context.Orders.AddObject(
                new Order()
                {
                });

            context.SaveChanges();
        }