Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Shouldly;
using Shouldly;
using Xunit;

namespace TestStack.BDDfy.Tests.Scanner.Examples
Expand All @@ -9,9 +8,9 @@ public class ExampleValueTests
[Fact]
public void CanFormatAsStringTests()
{
new ExampleValue("Header", null, () => 0).GetValueAsString().ShouldBe("'null'");
new ExampleValue("Header", null, () => 0).GetValueAsString().ShouldBe("<null>");
new ExampleValue("Header", 1, () => 0).GetValueAsString().ShouldBe("1");
new ExampleValue("Header", new Object(), () => 0).GetValueAsString().ShouldBe("System.Object");
new ExampleValue("Header", new object(), () => 0).GetValueAsString().ShouldBe("System.Object");
new ExampleValue("Header", new[] {1, 2}, () => 0).GetValueAsString().ShouldBe("1, 2");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Scenario: Fluent can be used with examples

Examples:
| Prop 1 | Prop2 | Prop 3 | Multi word heading |
| 1 | foo | ConsecutiveAssertion | |
| 1 | foo | ConsecutiveAssertion | <empty> |
| 2 | bar | Initialize | val2 |

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public static object FlattenArray(this object input)
return GetSafeValue(input);
}

static object GetSafeValue(object input) => input ?? "'null'";
static object GetSafeValue(object input) => input switch
{
null => "<null>",
string s => s == "" ? "<empty>" : (s.Trim() == "" ? $"'{s}'" : s),
_ => input
};
}
}
Loading