public void CanIsType() { var env = new StandardEnvironment(); Assert.IsTrue(env.IsType(null, "null")); Assert.IsTrue(env.IsType(true, "boolean")); Assert.IsTrue(env.IsType(1.25, "number")); Assert.IsTrue(env.IsType("foo", "string")); Assert.IsFalse(env.IsType(0, "null")); Assert.IsFalse(env.IsType(0, "boolean")); Assert.IsFalse(env.IsType("123", "number")); Assert.IsFalse(env.IsType(123, "string")); Assert.IsFalse(env.IsType(null, "boolean")); Assert.IsFalse(env.IsType(null, "number")); Assert.IsFalse(env.IsType(null, "string")); // Case in type name is ignored: Assert.IsTrue(env.IsType(null, "NULL")); Assert.IsTrue(env.IsType(false, "Boolean")); Assert.IsTrue(env.IsType(-500, "NuMbEr")); Assert.IsTrue(env.IsType("", "STRING")); // Unknown type name must throw an exception: var ex = Assert.Catch <EvaluationException>(() => env.IsType("foo", "NoSuchType")); Console.WriteLine(@"Expected: {0}", ex.Message); }