示例#1
0
        public void StringToFixedLengthDictionaryTest()
        {
            var dict = Splitter.FixedLength(3).WithKeyValueSeparator("=").SplitToDictionary(OriginalStrings.FixedLengthMapString);

            dict.Count.ShouldBe(5);

            dict["a"].ShouldBe("1");
            dict["b"].ShouldBe("2");
            dict["c"].ShouldBe("3");
            dict["d"].ShouldBe("4");
            dict["e"].ShouldBe("5");
        }
示例#2
0
        public void StringToFixedLengthKvpTest()
        {
            var kvp = Splitter.FixedLength(3).WithKeyValueSeparator("=").Split(OriginalStrings.FixedLengthMapString);

            // ReSharper disable once PossibleMultipleEnumeration
            kvp.Count().ShouldBe(5);

            // ReSharper disable once PossibleMultipleEnumeration
            var dict = kvp.ToDictionary(k => k.Key, v => v.Value);

            dict.Count.ShouldBe(5);

            dict["a"].ShouldBe("1");
            dict["b"].ShouldBe("2");
            dict["c"].ShouldBe("3");
            dict["d"].ShouldBe("4");
            dict["e"].ShouldBe("5");
        }