public void GetUndefinedAttributeAsNull() { DefinedClass klass = new DefinedClass("Spam"); Assert.IsNull(klass.GetValue("foo")); Assert.IsFalse(klass.HasValue("foo")); }
public void SetGetAttribute() { DefinedClass klass = new DefinedClass("Spam"); klass.SetValue("one", 1); var result = klass.GetValue("one"); Assert.IsNotNull(result); Assert.AreEqual(1, result); Assert.IsTrue(klass.HasValue("one")); }
public void GetValueFromSuperClass() { DefinedClass super = new DefinedClass("object"); super.SetValue("foo", 1); DefinedClass klass = new DefinedClass("Spam", new IType[] { super }); var result = klass.GetValue("foo"); Assert.IsNotNull(result); Assert.AreEqual(1, result); Assert.IsTrue(klass.HasValue("foo")); }
public void DefineMethodUsingSetValue() { DefinedClass klass = new DefinedClass("Spam"); IFunction method = new NativeMethod(this.DummyMethod); klass.SetValue("foo", method); var result = klass.GetMethod("foo"); Assert.IsNotNull(result); Assert.AreEqual(method, result); Assert.IsTrue(klass.HasMethod("foo")); Assert.IsTrue(klass.HasValue("foo")); }
public void ReplaceMethodWithAttribute() { DefinedClass klass = new DefinedClass("Spam"); IFunction method = new NativeMethod(this.DummyMethod); klass.SetMethod("foo", method); klass.SetValue("foo", 1); var result = klass.GetMethod("foo"); Assert.IsNull(result); Assert.IsFalse(klass.HasMethod("foo")); Assert.AreEqual(1, klass.GetValue("foo")); Assert.IsTrue(klass.HasValue("foo")); }