예제 #1
0
        public void FindSevenWordMatches_ReturnsCorrectCount()
        {
            string[]      arrOrigText = SplitText(OrigText);
            List <string> result      = SevenWordsLib.FindSevenWordMatches(PlagStudText, arrOrigText);

            Assert.AreEqual(6, result.Count);
        }
예제 #2
0
        public void FindSevenWordMatches_ReturnsNoMatches()
        {
            string[]      arrOrigText = SplitText(OrigText);
            List <string> result      = SevenWordsLib.FindSevenWordMatches(ParaphraseStudText, arrOrigText);

            Assert.IsEmpty(result);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string origText = SevenWordsLib.OnlyWords(txtOrig.Text);

            string[] origTextArr = origText.Split(' ');
            string   studentText = SevenWordsLib.OnlyWords(txtStudent.Text);

            if (string.IsNullOrWhiteSpace(origText) | string.IsNullOrWhiteSpace(studentText))
            {
                MessageBox.Show("Please enter text in both boxes");
                return;
            }
            else if (origTextArr.Length < 7)
            {
                MessageBox.Show("Please enter text with more than seven words");
            }

            List <string> sevenWordMatches = SevenWordsLib.FindSevenWordMatches(studentText, origTextArr);

            if (sevenWordMatches.Count == 0)
            {
                MessageBox.Show("No matching seven consecutive words are present");
            }
            else
            {
                MessageBox.Show(sevenWordMatches.Count + " matches found:" + Environment.NewLine +
                                string.Join(Environment.NewLine, sevenWordMatches));
            }
        }