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); }
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); }