Skip to content

Commit

Permalink
Add bottom border to ToString output
Browse files Browse the repository at this point in the history
Update README
Use approval testing pattern for ToString()
  • Loading branch information
rofr committed Jul 5, 2020
1 parent 8eccecd commit 27932f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Fig.Core/CompositeSettingsDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public string AsString()
}
}

sb.AppendLine("-".PadRight(colWidths.Sum(w => w) + 7, '-'));

return sb.ToString();
}

Expand Down
15 changes: 7 additions & 8 deletions Fig.Tests/DictionaryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,13 @@ public void AsString()

Console.WriteLine(toString);

Assert.AreEqual(toString, cd.AsString());

Assert.True(toString.Contains("- Layer 0 -"));
Assert.True(toString.Contains("- Layer 1 -"));
Assert.True(toString.Contains("| a "));
Assert.True(toString.Contains("| b "));
Assert.True(toString.Contains("| c:prod "));
Assert.True(toString.Contains("| d "));
var expected = "-------------------- Layer 0 ----------------------\n"
+ "| a | b |\n"
+ "-------------------- Layer 1 ----------------------\n"
+ "| c:prod | d |\n"
+ "---------------------------------------------------\n";

Assert.AreEqual(expected, toString);
}

[Test]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ Install-Package Fig.AppSettingsJson
## What do I have?
`Settings.ToString()` is your friend. It will return a plain-text formatted table
with keys and values of each layer:

```
-------------------- Layer 0 ----------------------
| Network.ip:TEST | 127.0.0.1 |
Expand Down

0 comments on commit 27932f1

Please sign in to comment.