Example #1
0
        public void Creates_array_of_complex()
        {
            Complex2[] complexes =
            {
                new Complex2 {
                    N1 = "Hello", N2 = "World"
                },
                new Complex2 {
                    N1 = "Hallo", N2 = "Welt"
                },
            };

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

            var expected  = new DArray();
            var dcomplex1 = new DComplex("MiP.ObjectDump.Tests.Reflection.ReflectorTests+Complex2", null);
            var dcomplex2 = new DComplex("MiP.ObjectDump.Tests.Reflection.ReflectorTests+Complex2", null);

            dcomplex1.AddProperty("N1", new DValue("Hello"));
            dcomplex1.AddProperty("N2", new DValue("World"));
            dcomplex2.AddProperty("N1", new DValue("Hallo"));
            dcomplex2.AddProperty("N2", new DValue("Welt"));

            expected.Add(dcomplex1);
            expected.Add(dcomplex2);

            expected.TypeHeader = "Complex2[] (2 items)";
            expected.AddColumns(new[] { "N1", "N2" });

            result.Should().BeEquivalentTo(expected, o => o.WithStrictOrdering().IncludingAllRuntimeProperties());
        }