Beispiel #1
0
        public void Question_1_1_Solution1_ReturnsFalse()
        {
            const string s        = "test";
            const bool   expected = false;

            Assert.AreEqual(expected, Question_1_1.AllUniqueCharactersHash(s));
        }
Beispiel #2
0
        public void Question_1_1_Solution2_NullString_ReturnsTrue()
        {
            const string s        = null;
            const bool   expected = true;

            Assert.AreEqual(expected, Question_1_1.AllUniqueCharactersNoAdditionalSpace(s));
        }
Beispiel #3
0
        public void Question_1_1_Solution1_EmptyString_ReturnsTrue()
        {
            const string s        = "";
            const bool   expected = true;

            Assert.AreEqual(expected, Question_1_1.AllUniqueCharactersHash(s));
        }
        public void IsUniqueTest_ReturnFalse(string inputStr)
        {
            bool result = Question_1_1.IsUnique(inputStr);

            Assert.IsFalse(result, $"{inputStr} is unique.");

            result = Question_1_1.IsUniqueInplaceNestedLoop(inputStr);
            Assert.IsFalse(result, $"{inputStr} is unique - In-place Nested Loop.");

            result = Question_1_1.IsUniqueInplaceSort(inputStr);
            Assert.IsFalse(result, $"{inputStr} is unique - In-place Sort.");
        }
        public void IsUniqueTest_ReturnTrue(string inputStr)
        {
            bool result = Question_1_1.IsUnique(inputStr);

            Assert.IsTrue(result, $"{inputStr} contains duplicates.");

            result = Question_1_1.IsUniqueInplaceNestedLoop(inputStr);
            Assert.IsTrue(result, $"{inputStr} contains duplicates - In-place Nested Loop.");

            result = Question_1_1.IsUniqueInplaceSort(inputStr);
            Assert.IsTrue(result, $"{inputStr} contains duplicates - In-place Sort.");
        }