コード例 #1
0
 public void TextContainsSymbols_Test()
 {
     Assert.False(TextTransform.CheckTextContainsSymbols("", Symbol.Brackets));
     Assert.False(TextTransform.CheckTextContainsSymbols("Hello, world!", Symbol.Quotes));
     Assert.True(TextTransform.CheckTextContainsSymbols("Hell(o)", Symbol.Brackets));
     Assert.True(TextTransform.CheckTextContainsSymbols("Organization name: «Pomoika Inc»", Symbol.Quotes));
     Assert.True(TextTransform.CheckTextContainsSymbols("Organization name: \"Pomoika Inc\"", Symbol.Quotes));
 }
コード例 #2
0
        public void SuccessfullTest()
        {
            var testCases = new Dictionary <string, string> {
                { "Hell(o)", "Hell(1)" },
                { "Hello, world (12345)!", "Hello, world (5)!" }
            };

            foreach (var test in testCases)
            {
                Assert.True(TextTransform.CheckTextContainsSymbols(test.Key, Symbol.Brackets), "There are no brackets in the text!");
                Assert.Equal(test.Value, TextTransform.RemoveTextBetweenSymbols(test.Key, Symbol.Brackets));
            }
        }
コード例 #3
0
        public void TreeQuotesTest()
        {
            var testCases = new Dictionary <string, string> {
                { "Organization name: «Pomoika Inc»", "Organization name: «11»" },
                { "«Hi there!» - he said", "«9» - he said" }
            };

            foreach (var test in testCases)
            {
                Assert.True(TextTransform.CheckTextContainsSymbols(test.Key, Symbol.Quotes), "There are no quotes in the text!");
                Assert.Equal(test.Value, TextTransform.RemoveTextBetweenSymbols(test.Key, Symbol.Quotes));
            }
        }
コード例 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var symbol = Rad_Brackets.IsChecked.Value ? Symbol.Brackets : Symbol.Quotes;

                if (!TextTransform.CheckTextContainsSymbols(Text_Enter.Text, symbol))
                {
                    MessageBox.Show("There are no selected symbols in the text!", "Oops...");
                }
                else
                {
                    Text_Out.Text = TextTransform.RemoveTextBetweenSymbols(Text_Enter.Text, symbol);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("There is an error:\n" + ex.Message, "Error!");
            }
        }