Exemplo n.º 1
0
		public void TestWordsMultipleAppearances()
		{
			Counter = new Counter();
			string text = "This is this and that is that";
			var words = Counter.CountWords(text);

			Assert.IsTrue(words[0] == "this - 2" && words[1] == "is - 2" && words[2] == "and - 1" && words[3] == "that - 2");
		}
Exemplo n.º 2
0
		public void TestWordsCleanWords()
		{
			Counter = new Counter();
			string text = "This? test) checks that words are clean of non words characters";
			var words = Counter.CountWords(text);

			Assert.IsTrue(words[0] == "this - 1" && words[1] == "test - 1");
		}
Exemplo n.º 3
0
		public void TestWordsNonWordsCharactersListed()
		{
			Counter = new Counter();
			string text = "This test checks the character like ? doesn't take into account";
			var words = Counter.CountWords(text);

			Assert.IsTrue(!words.Contains("? - 1"));
		}
Exemplo n.º 4
0
		public void TestWordsCounterSplit()
		{
			Counter = new Counter();
			string text = "This test checks the split";
			var words = Counter.CountWords(text);

			Assert.IsTrue(words.Count == 5);
		}
Exemplo n.º 5
0
		public void TestWordsCounterLowerCaseConversion()
		{
			Counter = new Counter();
			string text = "This test checks the lower case Conversion";
			var words = Counter.CountWords(text);

			Assert.IsTrue(words[0] == "this - 1" && words[6] == "conversion - 1");
		}
		void InputText_KeyUp(object sender, KeyEventArgs e)
		{
			OutputText.Text = string.Empty;
			var counter = new Counter();
			var wordsAppearences = counter.CountWords(InputText.Text);

			foreach (var word in wordsAppearences)
			{
				OutputText.Text = string.Format("{0} {1} \n", OutputText.Text, word);
			}
		}