示例#1
0
        public void Creates_complex_with_cyclic_references()
        {
            var four = new Complex4();
            var five = new Complex5 {
                Four = four
            };

            four.Five = five;

            var result = _reflector.GetDObject(four, 5);

            var expected     = new DComplex("MiP.ObjectDump.Tests.Reflection.ReflectorTests+Complex4", null);
            var fiveExpected = new DComplex("MiP.ObjectDump.Tests.Reflection.ReflectorTests+Complex5", null);

            expected.AddProperty("Five", fiveExpected);
            fiveExpected.AddProperty("Four", new CyclicReference("MiP.ObjectDump.Tests.Reflection.ReflectorTests+Complex4", Check_if_its_a_Guid));

            result.Should().BeEquivalentTo(expected, o => o.IncludingAllRuntimeProperties()
                                           .Using <string>(IsGuid)
                                           .When(m => m.RuntimeType == typeof(string)
                                                 &&
                                                 m.SelectedMemberInfo.Name == nameof(CyclicReference.Reference)
                                                 &&
                                                 m.SelectedMemberInfo.DeclaringType == typeof(CyclicReference))
                                           );
        }
示例#2
0
        public void Creates_complex_with_cyclic_typing()
        {
            var test = new Complex4 {
                Five = new Complex5 {
                    Four = new Complex4 {
                        Five = new Complex5()
                    }
                }
            };

            var result = _reflector.GetDObject(test, 5);

            // TODO: assert
        }