Esempio n. 1
0
        public void ShouldHandleRecursiveTypes()
        {
            ValueInjectionMetadataBuilder.ConfigureReplacement <RecursiveTestData>(f => f.Of(v => v.RemoteValue).With <RemoteTestData>().Property(t => t.RemoteValue).FromKey(k => k.RemoteValueKey));
            ValueInjector.UseValueObtainer(_remoteValueObtainer);

            var leftData  = new RecursiveTestData();
            var rightData = new RecursiveTestData();

            leftData.TestData  = rightData;
            rightData.TestData = leftData;

            ValueInjector.InjectValues(leftData);
        }
Esempio n. 2
0
        public void ShouldInjectInheritedProperties()
        {
            ValueInjectionMetadataBuilder.ConfigureReplacement <IHasRemoteTestData>(f => f.Of(p => p.RemoteTestData)
                                                                                    .With <RemoteTestData>()
                                                                                    .FromKey(td => td.ValueKey));

            ValueInjector.UseValueObtainer(_remoteValueObtainer);
            var testData = new InterfaceImplementingTestData {
                ValueKey = 1
            };

            ValueInjector.InjectValues(testData);

            Assert.NotNull(testData.RemoteTestData);
        }