Members with an ObsoleteAttribute are ignored:
class WithObsolete
{
[Obsolete]
public string ObsoleteProperty { get; set; }
public string OtherProperty { get; set; }
}
[Fact]
public Task WithObsoleteProp()
{
var target = new WithObsolete
{
ObsoleteProperty = "value1",
OtherProperty = "value2"
};
return Verify(target);
}
Result:
{
OtherProperty: value2
}
Obsolete members can be included using IncludeObsoletes
:
[Fact]
public Task WithObsoletePropIncluded()
{
var target = new WithObsolete
{
ObsoleteProperty = "value1",
OtherProperty = "value2"
};
var settings = new VerifySettings();
settings.IncludeObsoletes();
return Verify(target, settings);
}
[Fact]
public Task WithObsoletePropIncludedFluent()
{
var target = new WithObsolete
{
ObsoleteProperty = "value1",
OtherProperty = "value2"
};
return Verify(target)
.IncludeObsoletes();
}
Or globally:
VerifierSettings.IncludeObsoletes();
Result:
{
ObsoleteProperty: value1,
OtherProperty: value2
}