Association won't load when i run unittest RRS feed

  • Question

  • I am using NUnit, and have a very straightforward dbml file. My problem is that some of my associations don't load. Making my unit tests fail.

    When I set a breakpoint, add a watch, then look at the IQueryable, it looks fine, and since it gets dynamic loaded from looking at it, then my unit tests run smoothly.

    Here is my code (anonymized)

                var context = new MyDataContext();
                var query = from row in context.MyTable
                            where row.Foo == "123"
                            select row;
                _a = query.First();
                Assert.That(_a.MyAssociatedTable.FieldOne, Is.EqualTo("bar"));

    Does anyone have any good ideas for loading _a.MyAssociaionTable?
    Friday, June 15, 2012 12:08 PM


All replies