コード例 #1
0
            public void Throws_when_not_initialized()
            {
                var entityReference = new EntityReference<object>();

                Assert.Equal(
                    Strings.RelatedEnd_OwnerIsNull,
                    Assert.Throws<InvalidOperationException>(() => entityReference.Load()).Message);
            }
コード例 #2
0
        internal void BeginForeignKeyUpdate(EntityReference relationship)
        {
            Debug.Assert(!IsForeignKeyUpdate);

            RelationshipBeingUpdated = relationship;
            IsForeignKeyUpdate = true;
        }
コード例 #3
0
            public void OperationCanceledException_thrown_before_loading_results_if_task_is_cancelled()
            {
                var mockEntityWrapper = new Mock<IEntityWrapper>();
                mockEntityWrapper
                    .Setup(w => w.Entity)
                    .Returns(new object());

                var entityReference =
                    new EntityReference<object>(
                        mockEntityWrapper.Object,
                        new RelationshipNavigation("Going", "fromA", "toB", null, null),
                        new Mock<IRelationshipFixer>().Object);


                Assert.Throws<OperationCanceledException>(
                    () => entityReference.LoadAsync(new CancellationToken(canceled: true))
                        .GetAwaiter().GetResult());

                Assert.Throws<OperationCanceledException>(
                    () => entityReference.LoadAsync(MergeOption.NoTracking, new CancellationToken(canceled: true))
                        .GetAwaiter().GetResult());
            }
コード例 #4
0
            public void Throws_when_not_initialized()
            {
                var entityReference = new EntityReference<object>();

                Assert.Equal(
                    Strings.RelatedEnd_OwnerIsNull,
                    Assert.Throws<InvalidOperationException>(
                        () =>
                        ExceptionHelpers.UnwrapAggregateExceptions(
                            () =>
                            entityReference.LoadAsync(CancellationToken.None).Wait())).Message);
            }