public void Serialize_WithMemberFilterNested ()
    {
      var instance0 = new SerializerTestClassWithFields { PublicField1 = 11, PublicField2 = "test 0" };
      var instance1 = new SerializerTestClassWithFields { PublicField1 = 12, PublicField2 = "test 1" };
      var instance = new
      {
        EnumerableProperty = new[] { instance0, instance1 }
      };
      TestResultSerializer serializer = new TestResultSerializer (_writer, memberInfo => !memberInfo.Name.Equals("PublicField2"));

      serializer.Serialize (instance);
      var expected = "AnonymousType" + Environment.NewLine
                    + "  EnumerableProperty: Enumerable {" + Environment.NewLine
                    + "    SerializerTestClassWithFields" + Environment.NewLine
                    + "      PublicField1: 11" + Environment.NewLine
                    //+ "      PublicField2: 'test 0'" + Environment.NewLine
                    + "    SerializerTestClassWithFields" + Environment.NewLine
                    + "      PublicField1: 12" + Environment.NewLine
                    //+ "      PublicField2: 'test 1'" + Environment.NewLine
                    + "  }" + Environment.NewLine;

      Assert.That (_writer.ToString (), Is.EqualTo (expected));
    }
    public void Serialize_ComplexEnumerable ()
    {
      var instance0 = new SerializerTestClassWithFields { PublicField1 = 11, PublicField2 = "test 0" };
      var instance1 = new SerializerTestClassWithFields { PublicField1 = 12, PublicField2 = "test 1" };
      var enumerable = new[] { instance0, instance1 };

      _serializer.Serialize (enumerable);

      var expected = "Enumerable {" + Environment.NewLine
                     + "  SerializerTestClassWithFields" + Environment.NewLine
                     + "    PublicField1: 11" + Environment.NewLine
                     + "    PublicField2: 'test 0'" + Environment.NewLine
                     + "  SerializerTestClassWithFields" + Environment.NewLine
                     + "    PublicField1: 12" + Environment.NewLine
                     + "    PublicField2: 'test 1'" + Environment.NewLine
                     + "}" + Environment.NewLine;

      Assert.That (_writer.ToString(), Is.EqualTo (expected));
    }
    public void Serialize_EnumerableInProperty ()
    {
      var instance0 = new SerializerTestClassWithFields { PublicField1 = 11, PublicField2 = "test 0" };
      var instance1 = new SerializerTestClassWithFields { PublicField1 = 12, PublicField2 = "test 1" };
      var instance = new
                     {
                       EnumerableProperty = new[] { instance0, instance1 }
                     };

      _serializer.Serialize (instance);

      var expected = "AnonymousType" + Environment.NewLine
                    + "  EnumerableProperty: Enumerable {" + Environment.NewLine
                    + "    SerializerTestClassWithFields" + Environment.NewLine
                    + "      PublicField1: 11" + Environment.NewLine
                    + "      PublicField2: 'test 0'" + Environment.NewLine
                    + "    SerializerTestClassWithFields" + Environment.NewLine
                    + "      PublicField1: 12" + Environment.NewLine
                    + "      PublicField2: 'test 1'" + Environment.NewLine
                    + "  }" + Environment.NewLine;

      Assert.That (_writer.ToString (), Is.EqualTo (expected));
    }
    public void Serialize_ReferenceType_WithFields ()
    {
      var instance = new SerializerTestClassWithFields { PublicField1 = 17, PublicField2 = "test" };

      _serializer.Serialize (instance);

      var expected = "SerializerTestClassWithFields" + Environment.NewLine
          + "  PublicField1: 17" + Environment.NewLine
          + "  PublicField2: 'test'" + Environment.NewLine;
      Assert.That (_writer.ToString (), Is.EqualTo (expected));
    }