Пример #1
0
        public void NotBalanceItemFact()
        {
            var s    = "abA";
            var item = new BalanceItem("a", 0, 2);

            Assert.Equal(3, item.Distance());
            Assert.False(item.IsBalance(s));
            Assert.False(item.IsShortedBalance());
            Assert.True(item.IsUpperLowerSet());
        }
Пример #2
0
        public void BalanceItemFact()
        {
            var s    = "abAB";
            var item = new BalanceItem("ab", 0, 3);

            Assert.Equal(4, item.Distance());
            Assert.True(item.IsBalance(s));
            Assert.False(item.IsShortedBalance());
            Assert.True(item.IsUpperLowerSet());

            item.AddLowerCase('c');
            Assert.Equal("ABC", item.UpperCases);
        }
Пример #3
0
        public void ShortestBalanceItemFact()
        {
            Assert.Equal("aaa", new String(new List <char> {
                'a', 'a', 'a'
            }.ToArray()));

            var s    = "aA";
            var item = new BalanceItem('a', 0, 1);

            Assert.Equal(2, item.Distance());
            Assert.True(item.IsBalance(s));
            Assert.True(item.IsShortedBalance());
            Assert.True(item.IsUpperLowerSet());
        }