public void TestValidate() { var instanceofNode = new ExprInstanceofNode(new string[0]); instanceofNode.AddChildNode(new SupportExprNode(1)); // Test too few nodes under this node try { instanceofNode.Validate(SupportExprValidationContextFactory.MakeEmpty(container)); Assert.Fail(); } catch (ExprValidationException) { // Expected } // Test node result type not fitting instanceofNode.AddChildNode(new SupportExprNode("s")); try { instanceofNode.Validate(SupportExprValidationContextFactory.MakeEmpty(container)); Assert.Fail(); } catch (ExprValidationException) { // Expected } }
internal ExprInstanceofNodeForge( ExprInstanceofNode parent, Type[] classes) { ForgeRenderableInstanceOf = parent; Classes = classes; }
public void SetUp() { instanceofNodes = new ExprInstanceofNode[5]; instanceofNodes[0] = new ExprInstanceofNode(new[] { "long" }); instanceofNodes[0].AddChildNode(new SupportExprNode(1l, typeof(long?))); instanceofNodes[1] = new ExprInstanceofNode(new[] { typeof(SupportBean).FullName, "int", "string" }); instanceofNodes[1].AddChildNode(new SupportExprNode("", typeof(string))); instanceofNodes[2] = new ExprInstanceofNode(new[] { "string" }); instanceofNodes[2].AddChildNode(new SupportExprNode(null, typeof(bool?))); instanceofNodes[3] = new ExprInstanceofNode(new[] { "string", "char" }); instanceofNodes[3].AddChildNode(new SupportExprNode(new SupportBean(), typeof(object))); instanceofNodes[4] = new ExprInstanceofNode(new[] { "int", "float", typeof(SupportBean).FullName }); instanceofNodes[4].AddChildNode(new SupportExprNode(new SupportBean(), typeof(object))); }