コード例 #1
0
        public void Process_when_add_null_processing()
        {
            var inputText          = "Test input text.";
            var baseTextProcessing = new ReplacementTextProcessing("T", "t");

            baseTextProcessing.AddTextProcessing(null);
            var actualText = baseTextProcessing.Process(inputText);

            Assert.AreEqual(inputText.ToLower(), actualText);
        }
コード例 #2
0
        public void Process_when_not_transfer_input_parametrs()
        {
            var inputText          = "Test input text.";
            var baseTextProcessing = new ReplacementTextProcessing();
            var exp = Assert.Throws <ArgumentNullException>(() => {
                baseTextProcessing.Process(inputText);
            });

            Assert.IsTrue(exp.Message.Contains("Pattern:, ReplacingPattern:"));
        }
コード例 #3
0
        public void Process_when_add_one_processing()
        {
            var inputText          = "Test input text.";
            var expectedText       = "testinputtext.";
            var baseTextProcessing = new ReplacementTextProcessing("T", "t");
            var textProcessing     = Substitute.For <ITextProcessing>();

            textProcessing.Process(inputText).Returns("Testinputtext.");
            baseTextProcessing.AddTextProcessing(textProcessing);
            var actualText = baseTextProcessing.Process(inputText);

            Assert.AreEqual(expectedText, actualText);
        }
コード例 #4
0
        public void Process_when_add_more_then_one_processing()
        {
            var inputText                      = "Test, input, text.";
            var expectedText                   = "testinputtext";
            var baseTextProcessing             = new ReplacementTextProcessing("T", "t");
            var clearSpaceTextProcessing       = Substitute.For <ITextProcessing>();
            var clearPunctuationTextProcessing = Substitute.For <ITextProcessing>();

            clearSpaceTextProcessing.Process(inputText).Returns("Testinputtext.");
            clearPunctuationTextProcessing.Process("Testinputtext.").Returns("Testinputtext");
            baseTextProcessing.AddTextProcessing(clearSpaceTextProcessing);
            baseTextProcessing.AddTextProcessing(clearPunctuationTextProcessing);
            var actualText = baseTextProcessing.Process(inputText);

            Assert.AreEqual(expectedText, actualText);
        }