public void StringToFixedLengthListWithCustomTrimTest() { var @base = Splitter.FixedLength(3).SplitToList(OriginalStrings.IncludeWhiteSpaceString); @base.Count().ShouldBe(9); var list = Splitter.FixedLength(3).TrimResults(s => s.TrimStart()).SplitToList(OriginalStrings.IncludeWhiteSpaceString); list.Count().ShouldBe(9); @base[0].ShouldBe("abc"); @base[1].ShouldBe("def"); @base[2].ShouldBe("ghi"); @base[3].ShouldBe("jkl"); @base[4].ShouldBe("mno"); @base[5].ShouldBe("pqr"); @base[6].ShouldBe("stu"); @base[7].ShouldBe("vwx"); @base[8].ShouldBe(" yz"); list[0].ShouldBe("abc"); list[1].ShouldBe("def"); list[2].ShouldBe("ghi"); list[3].ShouldBe("jkl"); list[4].ShouldBe("mno"); list[5].ShouldBe("pqr"); list[6].ShouldBe("stu"); list[7].ShouldBe("vwx"); list[8].ShouldBe("yz"); }
public void TestLimitFixedLength() { const string simple = "abcd"; var letters = Splitter.FixedLength(1).Limit(2).split(simple); letters.Should().ContainExactlyInOrder("a", "bcd"); }
public void TestFixedLengthSplitIntoChars() { const string simple = "abcd"; var letters = Splitter.FixedLength(1).split(simple); letters.Should().ContainExactlyInOrder("a", "b", "c", "d"); }
public void TestFixedLengthSplitEmptyString() { const string simple = ""; var letters = Splitter.FixedLength(3).split(simple); letters.Should().ContainExactlyInOrder(""); }
public void TestFixedLengthSplitOnlyOneChunk() { const string simple = "abc"; var letters = Splitter.FixedLength(3).split(simple); letters.Should().ContainExactlyInOrder("abc"); }
public void TestFixedLengthSplitEqualChunkLength() { const string simple = "abcdef"; var letters = Splitter.FixedLength(2).split(simple); letters.Should().ContainExactlyInOrder("ab", "cd", "ef"); }
public void StringToFixedLengthListWithLimitTest() { var list = Splitter.FixedLength(3).Limit(3).SplitToList(OriginalStrings.NormalString); list.Count().ShouldBe(3); list[0].ShouldBe("abc"); list[1].ShouldBe("def"); list[2].ShouldBe("ghi"); }
public void StringToFixedLengthEnumerableWithLimitTest() { var enumerable = Splitter.FixedLength(3).Limit(3).Split(OriginalStrings.NormalString); // ReSharper disable once PossibleMultipleEnumeration enumerable.Count().ShouldBe(3); // ReSharper disable once PossibleMultipleEnumeration var list = enumerable.ToList(); list.Count().ShouldBe(3); list[0].ShouldBe("abc"); list[1].ShouldBe("def"); list[2].ShouldBe("ghi"); }
public void StringToFixedLengthListTest() { var list = Splitter.FixedLength(3).SplitToList(OriginalStrings.NormalString); list.Count().ShouldBe(9); list[0].ShouldBe("abc"); list[1].ShouldBe("def"); list[2].ShouldBe("ghi"); list[3].ShouldBe("jkl"); list[4].ShouldBe("mno"); list[5].ShouldBe("pqr"); list[6].ShouldBe("stu"); list[7].ShouldBe("vwx"); list[8].ShouldBe("yz"); }
public void StringToFixedLengthEnumerableWithTrimTest() { var @base = Splitter.FixedLength(3).Split(OriginalStrings.IncludeWhiteSpaceString); // ReSharper disable once PossibleMultipleEnumeration @base.Count().ShouldBe(9); var enumerable = Splitter.FixedLength(3).TrimResults().Split(OriginalStrings.IncludeWhiteSpaceString); // ReSharper disable once PossibleMultipleEnumeration enumerable.Count().ShouldBe(9); // ReSharper disable once PossibleMultipleEnumeration var @baseList = @base.ToList(); @baseList[0].ShouldBe("abc"); @baseList[1].ShouldBe("def"); @baseList[2].ShouldBe("ghi"); @baseList[3].ShouldBe("jkl"); @baseList[4].ShouldBe("mno"); @baseList[5].ShouldBe("pqr"); @baseList[6].ShouldBe("stu"); @baseList[7].ShouldBe("vwx"); @baseList[8].ShouldBe(" yz"); // ReSharper disable once PossibleMultipleEnumeration var list = enumerable.ToList(); list[0].ShouldBe("abc"); list[1].ShouldBe("def"); list[2].ShouldBe("ghi"); list[3].ShouldBe("jkl"); list[4].ShouldBe("mno"); list[5].ShouldBe("pqr"); list[6].ShouldBe("stu"); list[7].ShouldBe("vwx"); list[8].ShouldBe("yz"); }
public void StringToFixedLengthEnumerableTest() { var enumerable = Splitter.FixedLength(3).Split(OriginalStrings.NormalString); // ReSharper disable once PossibleMultipleEnumeration enumerable.Count().ShouldBe(9); // ReSharper disable once PossibleMultipleEnumeration var list = enumerable.ToList(); list.Count().ShouldBe(9); list[0].ShouldBe("abc"); list[1].ShouldBe("def"); list[2].ShouldBe("ghi"); list[3].ShouldBe("jkl"); list[4].ShouldBe("mno"); list[5].ShouldBe("pqr"); list[6].ShouldBe("stu"); list[7].ShouldBe("vwx"); list[8].ShouldBe("yz"); }
public void TestFixedLengthSplitNegativeChunkLen() { Splitter.FixedLength(-1); }
public void TestFixedLengthSplitZeroChunkLen() { Splitter.FixedLength(0); }
public void TestFixedLengthSplitEmptyStringWithOmitEmptyStrings() { Splitter.FixedLength(3).OmitEmptyStrings().split("").Should().BeEmpty(); }