Example #1
0
        public void UnionNotCommutativeTest()
        {
            const string text1 = "one";
            const string text2 = "qwerty";

            var mergedText = (text1 + text2).Distinct().ToList();

            var alphabet1 = new Alphabet(text1);
            var alphabet2 = new Alphabet(text2);

            var union1 = Alphabet.Union(alphabet1, alphabet2);
            var union2 = Alphabet.Union(alphabet2, alphabet1);

            Assert.AreNotEqual(union1, union2);
        }
Example #2
0
        public void UnionTest()
        {
            const string text1 = "one";
            const string text2 = "qwerty";

            var mergedText = (text1 + text2).Distinct().ToList();

            var alphabet1 = new Alphabet(text1);
            var alphabet2 = new Alphabet(text2);

            var result = Alphabet.Union(alphabet1, alphabet2);

            for (int i = 0; i < mergedText.Count; i++)
            {
                Assert.AreEqual(mergedText[i], result.CharAt(i));
            }
        }