public void IsFittingEnumCommectTest() { var decl = new CodeTypeDeclaration(); IEnumerable <string> enumValues = new[] { "foo", "bar", "42" }; IEnumerable <string> enumCommentsA = new[] { "fish", "dolphins", "mice" }; IEnumerable <string> enumCommentsB = new[] { "fishy", "dolphiny", "micy" }; IEnumerable <string> enumCommentsC = null; // Add an enum, and check whether it can be found. CodeTypeDeclaration testEnum = EnumResourceDecorator.GenerateEnum( decl, "SomeName", "SomeDescription", enumValues, enumCommentsA); decl.Members.Add(testEnum); Assert.IsTrue(DecoratorUtil.IsFittingEnum(testEnum, enumValues, enumCommentsA)); Assert.IsFalse(DecoratorUtil.IsFittingEnum(testEnum, enumValues, enumCommentsB)); Assert.IsFalse(DecoratorUtil.IsFittingEnum(testEnum, enumValues, enumCommentsC)); }
public void IsFittingEnumTest() { var decl = new CodeTypeDeclaration(); IEnumerable <string> enumValues = new[] { "foo", "bar", "42" }; IEnumerable <string> enumValues2 = new[] { "foo", "bar", "cake" }; IEnumerable <string> enumValues3 = new[] { "foo", "bar" }; // Add an enum, and check whether it can be found. CodeTypeDeclaration testEnum = EnumResourceDecorator.GenerateEnum( decl, "SomeName", "SomeDescription", enumValues, null); decl.Members.Add(testEnum); Assert.IsTrue(DecoratorUtil.IsFittingEnum(testEnum, enumValues, null)); Assert.IsFalse(DecoratorUtil.IsFittingEnum(testEnum, enumValues2, null)); Assert.IsFalse(DecoratorUtil.IsFittingEnum(testEnum, enumValues3, null)); Assert.IsFalse(DecoratorUtil.IsFittingEnum(testEnum, Enumerable.Empty <string>(), null)); }