Hi
We have an assertion like this
result.Should().BeSameAs(FindFileResult.NotFound)
that fails.
When FluentAssertions build the error message, it dumps the values of all properties. In our case this is a problem because one property throws an exception:
public class FindFileResult
{
public static readonly FindFileResult NotFound = new FindFileResult(null, false);
private readonly string filePath;
public FindFileResult(string filePath, bool found)
{
this.filePath = filePath;
this.Found = found;
}
public bool Found { get; private set; }
public string AbsoluteFilePath
{
get
{
if (!this.Found)
{
throw new InvalidOperationException("Path is not available when it is not found");
}
return this.filePath;
}
}
}
It would be nice if FluentAssertions would just ignore properties that result in an exception and continue with the next.
Cheers
Urs
Comments: Associated with changeset 73253.
We have an assertion like this
result.Should().BeSameAs(FindFileResult.NotFound)
that fails.
When FluentAssertions build the error message, it dumps the values of all properties. In our case this is a problem because one property throws an exception:
public class FindFileResult
{
public static readonly FindFileResult NotFound = new FindFileResult(null, false);
private readonly string filePath;
public FindFileResult(string filePath, bool found)
{
this.filePath = filePath;
this.Found = found;
}
public bool Found { get; private set; }
public string AbsoluteFilePath
{
get
{
if (!this.Found)
{
throw new InvalidOperationException("Path is not available when it is not found");
}
return this.filePath;
}
}
}
It would be nice if FluentAssertions would just ignore properties that result in an exception and continue with the next.
Cheers
Urs
Comments: Associated with changeset 73253.