public void IsPropertyChanged_throws_for_a_relationship_entry() { using (var context = new SimpleModelForLinq()) { context.Orders.Load(); var stateEntry = GetObjectContext(context) .ObjectStateManager .GetObjectStateEntries(~EntityState.Detached) .Where(s => s.IsRelationship) .First(); Assert.Throws<InvalidOperationException>(() => stateEntry.IsPropertyChanged("Name")).ValidateMessage( "ObjectStateEntry_CantModifyRelationState"); } }
public void SelectMany_works_under_partial_trust() { using (var context = new SimpleModelForLinq()) { var parameter = 1; var query = from n in context.Numbers from p in context.Products where n.Value > p.UnitsInStock && n.Value == parameter select new LinqTests.NumberProductProjectionClass { Value = n.Value, UnitsInStock = p.UnitsInStock }; Assert.IsType<DbQuery<LinqTests.NumberProductProjectionClass>>(query); query.Load(); } }