Skip to content

Booleans with Default Value are not Ignored #1660

@JoshHariz

Description

@JoshHariz

Describe the bug

When verifying a class with a boolean property, it seems that property always shows up in the result file, even when the value is false and DefaultValueHandling is set to Ignore.

Am I missing a way to ignore them or is this a bug?

Minimal Repro

    public class Tests
    {
        public class Example
        {
            public bool Bool;
            public string Content = "yes";
            public string NoContent;
            public int Num;
            public char Char;
            public double Double;
        }


        [Fact]
        public async Task Test()
        {
            // Arrange
            await Verify(new Example())
                .AddExtraSettings(x => x.DefaultValueHandling = Argon.DefaultValueHandling.Ignore);
        }
    }

Expected:

{
  Content: yes,
}

Actual:

{
  Bool: false,
  Content: yes,
  Char: 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions