예제 #1
0
 public void Strings_are_split_based_on_dots()
 {
     string[] strings = DefaultLoader.DotByDot("this.is.a.test").ToArray();
     Assert.Equal(4, strings.Length);
     Assert.Equal("this.is.a.test", strings[0]);
     Assert.Equal("this.is.a", strings[1]);
     Assert.Equal("this.is", strings[2]);
     Assert.Equal("this", strings[3]);
 }
예제 #2
0
        public void Leading_and_trailing_dot_and_empty_strings_are_safe_and_ignored()
        {
            string[] string1 = DefaultLoader.DotByDot(".a.test").ToArray();
            string[] string2 = DefaultLoader.DotByDot("a.test.").ToArray();
            string[] string3 = DefaultLoader.DotByDot(".a.test.").ToArray();
            string[] string4 = DefaultLoader.DotByDot(".").ToArray();
            string[] string5 = DefaultLoader.DotByDot(string.Empty).ToArray();
            string[] string6 = DefaultLoader.DotByDot(null).ToArray();

            AssertArrayEqual(new[] { "a.test", "a" }, string1);
            AssertArrayEqual(new[] { "a.test", "a" }, string2);
            AssertArrayEqual(new[] { "a.test", "a" }, string3);
            AssertArrayEqual(new string[0], string4);
            AssertArrayEqual(new string[0], string5);
            AssertArrayEqual(new string[0], string6);
        }