예제 #1
0
        public void Test_NullFromat()
        {
            var value = _fixture.Create <string>();
            var text  = TextBuilderHelper.GetText(_currentCulture, null, value);

            text.ShouldBeEquivalentTo(value);
        }
예제 #2
0
        public void Test_GetText()
        {
            var value = _fixture.Create <string>();
            var text  = TextBuilderHelper.GetText(_currentCulture, "Text: {0}.", value);

            text.ShouldBeEquivalentTo("Text: " + value + ".");
        }
예제 #3
0
        public void Test_BadFromat()
        {
            var          value  = _fixture.Create <string>();
            const string format = "Text: {0.";
            var          text   = TextBuilderHelper.GetText(_currentCulture, format, value);

            text.ShouldBeEquivalentTo(format + value);
        }
예제 #4
0
        public void Test_OneMatchRussian()
        {
            string text;
            string format;
            var    match = TextBuilderHelper.GetMatch("asdfsf {Имя} asdfsa", "Имя", out text, out format);

            match.Should().BeTrue();
            text.ShouldBeEquivalentTo("{Имя}");
            format.Should().BeNull();
        }
예제 #5
0
        public void Test_TwoMatch()
        {
            string text;
            string format;
            var    match = TextBuilderHelper.GetMatch("asdfsf {name} {name [format]} asdfsa", "name", out text, out format);

            match.Should().BeTrue();
            text.ShouldBeEquivalentTo("{name}");
            format.Should().BeNull();
        }
예제 #6
0
        public void Test_BadMatch2()
        {
            string text;
            string format;
            var    match = TextBuilderHelper.GetMatch("asdfsf {name [asdfsa]", "name", out text, out format);

            match.Should().BeFalse();
            text.Should().BeNull();
            format.Should().BeNull();
        }
예제 #7
0
        public void Test_NoMatch()
        {
            string text;
            string format;
            var    match = TextBuilderHelper.GetMatch("asdfsf {name1} asdfsa {name3}", "name2", out text, out format);

            match.Should().BeFalse();
            text.Should().BeNull();
            format.Should().BeNull();
        }
예제 #8
0
        public void Test_NoneToMatch()
        {
            string text;
            string format;
            var    match = TextBuilderHelper.GetMatch(_fixture.Create <string>(), _fixture.Create <string>(), out text, out format);

            match.Should().BeFalse();
            text.Should().BeNull();
            format.Should().BeNull();
        }
예제 #9
0
        public void Test_SimpleFromat()
        {
            string text;
            string format;
            var    match = TextBuilderHelper.GetMatch("asdfsf {name [f1]} asfasdfagt5t!!", "name", out text, out format);

            match.Should().BeTrue();
            text.ShouldBeEquivalentTo("{name [f1]}");
            format.ShouldBeEquivalentTo("f1");
        }
예제 #10
0
        public void Test_ComlexFromat()
        {
            string       text;
            string       formatOut;
            const string format = "\"f1/0.123\":]\t[ '#{0}'!!!";
            const string name   = "{name [" + format + "]}";
            var          match  = TextBuilderHelper.GetMatch("asdfsf " + name + " asfasdfagt5t!!", "name", out text, out formatOut);

            match.Should().BeTrue();
            text.ShouldBeEquivalentTo(name);
            formatOut.ShouldBeEquivalentTo(format);
        }
예제 #11
0
        public void Test_NullValue()
        {
            var text = TextBuilderHelper.GetText(_currentCulture, _fixture.Create <string>(), null);

            text.ShouldBeEquivalentTo(string.Empty);
        }