public void FunctionReturnsSetOfComplexTypes() { var context = new AWEntities(); var details = context.GetCustomerNamesWithSalesOrderTotals().ToList(); Assert.IsInstanceOfType(details[0], typeof(CustomerOrderOverview), "Function did not return CustomerOrderOverview objects"); Assert.AreNotEqual(0, details.Count()); //test to assure that context is not tracking anything after this query Assert.AreEqual(0, context.ObjectStateManager.GetObjectStateEntries(System.Data.EntityState.Unchanged).Count()); }