-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completed basic support for format sequence.
- Loading branch information
1 parent
b5e5b11
commit 839f9fa
Showing
2 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Hussy.Net.Tests.Display; | ||
|
||
public class FormatArrayTests | ||
{ | ||
[Fact] | ||
public void FormatSequence_Null_ReturnsEmptyBrackets() | ||
{ | ||
const string expectedResult = "[]"; | ||
var actualResult = Fsq<int>(null); | ||
Assert.Equal(expectedResult, actualResult); | ||
} | ||
|
||
[Fact] | ||
public void FormatSequence_EmptyInput_ReturnsEmptyBrackets() | ||
{ | ||
const string expectedResult = "[]"; | ||
var actualResult = Fsq<int>([]); | ||
Assert.Equal(expectedResult, actualResult); | ||
} | ||
|
||
[Fact] | ||
public void FormatSequence_SequenceContainsElements_ReturnsElementsWrappedInBrackets() | ||
{ | ||
const string expectedResult = "[1, 2, 3]"; | ||
var input = Enumerable.Range(1, 3); | ||
var actualResult = Fsq(input); | ||
Assert.Equal(expectedResult, actualResult); | ||
} | ||
|
||
[Fact] | ||
public void FormatSequence_SpecifiedSeparator_ReturnsElementsWithSeparator() | ||
{ | ||
const string separator = ":"; | ||
const string expectedResult = $"[1{separator}2]"; | ||
var input = Enumerable.Range(1, 2); | ||
var actualResult = Fsq(input, separator); | ||
Assert.Equal(expectedResult, actualResult); | ||
} | ||
} |