internal int Add(string name, SchemaImporterExtension extension) { if (Names[name] != null) { if (Names[name].GetType() != extension.GetType()) { throw new InvalidOperationException(Res.GetString(Res.XmlConfigurationDuplicateExtension, name)); } return -1; } Names[name] = extension; return List.Add(extension); }
public void Add () { SchemaImporterExtensionCollection c = new SchemaImporterExtensionCollection (); Assert.AreEqual (0, c.Add ("foo", typeof (MyExtension)), "#1"); Assert.IsTrue (c [0] is MyExtension, "#2"); }