예제 #1
0
        public IEnumerator <string> GetStringsContaining(string chars)
        {
            if (chars == null || chars == "")
            {
                return(rowset.GetEnumerator());
            }

            IStringFilter resultSet = new StringFilter();

            foreach (string elem in rowset)
            {
                if (elem.Contains(chars))
                {
                    resultSet.Add(elem);
                }
            }

            return(resultSet.GetCollection().GetEnumerator());
        }
예제 #2
0
        public static bool TestAdd()
        {
            //arrange
            ISet <string> forActual = new HashSet <string>();

            forActual.Add("abcde");
            IStringFilter actual = new StringFilter(forActual);

            ISet <string> forExpected = new HashSet <string>();

            forExpected.Add("abcde");
            forExpected.Add("gg");
            IStringFilter expected = new StringFilter(forExpected);

            //act
            actual.Add("gg");

            //assert

            return(IsEqualSet(actual.GetCollection(), expected.GetCollection()));
        }