public void GetOptionalRelatedObjectOverVirtualEndPointTwice()
        {
            var id = new ObjectID("ClassWithGuidKey", new Guid("{672C8754-C617-4b7a-890C-BFEF8AC86564}"));

            CountingObjectLoaderDecorator decorator = null;
            var clientTransactionMock = ClientTransactionObjectMother.CreateTransactionWithObjectLoaderDecorator <TestableClientTransaction> (
                loader => decorator ?? (decorator = new CountingObjectLoaderDecorator(loader)));

            DomainObject classWithGuidKey = clientTransactionMock.GetObject(id, false);

            Assert.That(decorator.NumberOfCallsToLoadObject, Is.EqualTo(1));
            Assert.That(decorator.NumberOfCallsToLoadRelatedObject, Is.EqualTo(0));

            Assert.That(
                clientTransactionMock.GetRelatedObject(
                    RelationEndPointID.Create(
                        classWithGuidKey.ID, "Remotion.Data.DomainObjects.UnitTests.TestDomain.ClassWithGuidKey.ClassWithValidRelationsOptional")),
                Is.Null);

            Assert.That(decorator.NumberOfCallsToLoadObject, Is.EqualTo(1));
            Assert.That(decorator.NumberOfCallsToLoadRelatedObject, Is.EqualTo(1));

            clientTransactionMock.GetRelatedObject(
                RelationEndPointID.Create(classWithGuidKey.ID, "Remotion.Data.DomainObjects.UnitTests.TestDomain.ClassWithGuidKey.ClassWithValidRelationsOptional"));

            Assert.That(decorator.NumberOfCallsToLoadObject, Is.EqualTo(1));
            Assert.That(decorator.NumberOfCallsToLoadRelatedObject, Is.EqualTo(1));
        }
        public void GetOptionalRelatedObjectTwice()
        {
            var id = new ObjectID("ClassWithValidRelations", new Guid("{6BE4FA61-E050-469c-9DBA-B47FFBB0F8AD}"));

            CountingObjectLoaderDecorator decorator = null;
            var clientTransaction =
                ClientTransactionObjectMother.CreateTransactionWithObjectLoaderDecorator <TestableClientTransaction> (
                    loader => decorator ?? (decorator = new CountingObjectLoaderDecorator(loader)));

            DomainObject classWithValidRelation = clientTransaction.GetObject(id, false);

            Assert.That(decorator.NumberOfCallsToLoadObject, Is.EqualTo(1));
            Assert.That(decorator.NumberOfCallsToLoadRelatedObject, Is.EqualTo(0));

            Assert.That(
                clientTransaction.GetRelatedObject(
                    RelationEndPointID.Create(
                        classWithValidRelation.ID, "Remotion.Data.DomainObjects.UnitTests.TestDomain.ClassWithValidRelations.ClassWithGuidKeyOptional")),
                Is.Null);

            Assert.That(decorator.NumberOfCallsToLoadObject, Is.EqualTo(1));
            Assert.That(decorator.NumberOfCallsToLoadRelatedObject, Is.EqualTo(0));

            clientTransaction.GetRelatedObject(
                RelationEndPointID.Create(classWithValidRelation.ID, "Remotion.Data.DomainObjects.UnitTests.TestDomain.ClassWithValidRelations.ClassWithGuidKeyOptional"));

            Assert.That(decorator.NumberOfCallsToLoadObject, Is.EqualTo(1));
            Assert.That(decorator.NumberOfCallsToLoadRelatedObject, Is.EqualTo(0));
        }