Пример #1
0
        private string GetNewStyleName <T>(StyleCollection <T> styleCollection)
            where T : class, IStyle
        {
            string newName;
            string typeName = typeof(T).Name;
            int    cnt      = styleCollection.Count;

            do
            {
                newName = string.Format("{0} {1}", typeName, ++cnt);
            }while (styleCollection.Contains(newName));
            return(newName);
        }
Пример #2
0
        public void StyleCollection_Contains()
        {
            // Arrange
            var style = new Style("id");
            var list  = new StyleCollection();

            list.Add(style);

            // Act
            var value = list.Contains(style);

            // Assert
            Assert.IsTrue(value);
        }