public void RegisterScriptableObject_Reserved() { PublicScriptable instance = new PublicScriptable(); // reserved *method* (not registration) names HtmlPage.RegisterScriptableObject("addEventListener", instance); HtmlPage.RegisterScriptableObject("removeEventListener", instance); HtmlPage.RegisterScriptableObject("constructor", instance); HtmlPage.RegisterScriptableObject("createManagedObject", instance); // case sensitive test case HtmlPage.RegisterScriptableObject("CONSTRUCTOR-casing", new Scriptable_CONSTRUCTOR()); // reserved members Assert.Throws <InvalidOperationException> (delegate { HtmlPage.RegisterScriptableObject("bad-addEventListener", new Scriptable_addEventListener()); }, "addEventListener,instance"); Assert.Throws <InvalidOperationException> (delegate { HtmlPage.RegisterScriptableObject("bad-removeEventListener", new Scriptable_removeEventListener()); }, "removeEventListener,instance"); Assert.Throws <InvalidOperationException> (delegate { HtmlPage.RegisterScriptableObject("bad-CONSTRUCTOR", new Scriptable_constructor()); }, "constructor,instance"); Assert.Throws <InvalidOperationException> (delegate { HtmlPage.RegisterScriptableObject("bad-createManagedObject", new Scriptable_createManagedObject()); }, "createManagedObject,instance"); HtmlPage.RegisterScriptableObject("non-scriptable-reserved-names", new NonScriptableReservedNames()); }
public void RegisterScriptableObject() { PublicScriptable instance = new PublicScriptable(); Assert.Throws <ArgumentNullException> (delegate { HtmlPage.RegisterScriptableObject(null, instance); }, "null,instance"); Assert.Throws <ArgumentException> (delegate { HtmlPage.RegisterScriptableObject(String.Empty, instance); }, "Empty,instance"); Assert.Throws <ArgumentException> (delegate { HtmlPage.RegisterScriptableObject("a\0b", instance); }, "string-with-null,instance"); Assert.Throws <ArgumentNullException> (delegate { HtmlPage.RegisterScriptableObject("a", null); }, "string,null"); Assert.Throws <InvalidOperationException> (delegate { HtmlPage.RegisterScriptableObject("non-public", new Private()); }, "string,non-public"); Assert.Throws <ArgumentException> (delegate { HtmlPage.RegisterScriptableObject("no-scriptable-member", new Ok()); }, "string,no-scriptable-member"); }
public void RegisterScriptableObject_Reserved () { PublicScriptable instance = new PublicScriptable (); // reserved *method* (not registration) names HtmlPage.RegisterScriptableObject ("addEventListener", instance); HtmlPage.RegisterScriptableObject ("removeEventListener", instance); HtmlPage.RegisterScriptableObject ("constructor", instance); HtmlPage.RegisterScriptableObject ("createManagedObject", instance); // case sensitive test case HtmlPage.RegisterScriptableObject ("CONSTRUCTOR-casing", new Scriptable_CONSTRUCTOR ()); // reserved members Assert.Throws<InvalidOperationException> (delegate { HtmlPage.RegisterScriptableObject ("bad-addEventListener", new Scriptable_addEventListener ()); }, "addEventListener,instance"); Assert.Throws<InvalidOperationException> (delegate { HtmlPage.RegisterScriptableObject ("bad-removeEventListener", new Scriptable_removeEventListener ()); }, "removeEventListener,instance"); Assert.Throws<InvalidOperationException> (delegate { HtmlPage.RegisterScriptableObject ("bad-CONSTRUCTOR", new Scriptable_constructor ()); }, "constructor,instance"); Assert.Throws<InvalidOperationException> (delegate { HtmlPage.RegisterScriptableObject ("bad-createManagedObject", new Scriptable_createManagedObject ()); }, "createManagedObject,instance"); HtmlPage.RegisterScriptableObject ("non-scriptable-reserved-names", new NonScriptableReservedNames ()); }
public void RegisterScriptableObject () { PublicScriptable instance = new PublicScriptable (); Assert.Throws<ArgumentNullException> (delegate { HtmlPage.RegisterScriptableObject (null, instance); }, "null,instance"); Assert.Throws<ArgumentException> (delegate { HtmlPage.RegisterScriptableObject (String.Empty, instance); }, "Empty,instance"); Assert.Throws<ArgumentException> (delegate { HtmlPage.RegisterScriptableObject ("a\0b", instance); }, "string-with-null,instance"); Assert.Throws<ArgumentNullException> (delegate { HtmlPage.RegisterScriptableObject ("a", null); }, "string,null"); Assert.Throws<InvalidOperationException> (delegate { HtmlPage.RegisterScriptableObject ("non-public", new Private ()); }, "string,non-public"); Assert.Throws<ArgumentException> (delegate { HtmlPage.RegisterScriptableObject ("no-scriptable-member", new Ok ()); }, "string,no-scriptable-member"); }