コード例 #1
0
        public void Add_ValidWordArgument_TrueAndChangeAnagramRest(string anagram, string word, string expectedAnagramRest)
        {
            var anagramMatchTracker = new AnagramMatchTracker(anagram);

            Assert.True(anagramMatchTracker.Add(word));
            Assert.AreEqual(expectedAnagramRest, anagramMatchTracker.AnagramRest);
        }
コード例 #2
0
 public void Add_InvalidWordArgument_FalseAndUnchangedAnagramRest(string word)
 {
     var anagramMatchTracker = new AnagramMatchTracker("anagram");
     var existingAnagramRest = anagramMatchTracker.AnagramRest;
     Assert.False(anagramMatchTracker.Add(word));
     Assert.AreEqual(existingAnagramRest, anagramMatchTracker.AnagramRest);
 }
コード例 #3
0
        public void Remove_AddWordAndRemoveItAgain_AnagramRestSame(string anagram, string word, string expectedAnagramRest)
        {
            var anagramMatchTracker = new AnagramMatchTracker(anagram);
            anagramMatchTracker.Add(word);
            anagramMatchTracker.Remove();

            Assert.AreEqual(expectedAnagramRest, anagramMatchTracker.AnagramRest);
        }
コード例 #4
0
        public void Constructor_ValidAnagramArgument_NewInstance()
        {
            var anagramMatchTracker = new AnagramMatchTracker("anagram");

            Assert.NotNull(anagramMatchTracker);
            Assert.AreEqual(0, anagramMatchTracker.Count);
            Assert.False(anagramMatchTracker.IsAnagramRestEmpty);
        }
コード例 #5
0
        public void Remove_FullAnagramRest_InvalidOperationException()
        {
            var anagramMatchTracker = new AnagramMatchTracker("anagram");

            Assert.Throws<InvalidOperationException>(() => anagramMatchTracker.Remove());
        }
コード例 #6
0
        public void AnagramRest_NewInstanceWithValidAnagramArgument_AnagramRestWithWhitespaceRemoved(string anagram, string expectedAnagramRest)
        {
            var anagramMatchTracker = new AnagramMatchTracker(anagram);

            Assert.AreEqual(expectedAnagramRest, anagramMatchTracker.AnagramRest);
        }