public void Generic_DbCollectionEntry_throws_OperationCanceledException_if_task_is_cancelled() { var entityEntry = new DbEntityEntry <FakeWithProps>(FakeWithProps.CreateMockInternalEntityEntry().Object); var mockWrapper = new Mock <IEntityWrapper>(); mockWrapper.Setup(w => w.Entity).Returns(new object()); ((RelatedEnd)entityEntry .Collection(e => e.Collection).InternalMemberEntry.InternalEntityEntry.GetRelatedEnd("Collection")) .SetWrappedOwner(mockWrapper.Object); Assert.Throws <OperationCanceledException>( () => entityEntry.Collection(e => e.Collection).LoadAsync(new CancellationToken(canceled: true)) .GetAwaiter().GetResult()); }
public void EntityEntity_can_be_obtained_from_non_generic_DbCollectionEntry_back_reference() { var entityEntry = new DbEntityEntry <FakeWithProps>(FakeWithProps.CreateMockInternalEntityEntry().Object); var backEntry = entityEntry.Collection("Collection").EntityEntry; Assert.Same(entityEntry.Entity, backEntry.Entity); }