public void TestValidate() { // Must have exactly 2 subnodes try { _bitWiseNode.Validate(SupportExprValidationContextFactory.MakeEmpty(_container)); Assert.Fail(); } catch (ExprValidationException) { // Expected Log.Debug("No nodes in the expression"); } // Must have only number or boolean-type subnodes _bitWiseNode.AddChildNode(new SupportExprNode(typeof(string))); _bitWiseNode.AddChildNode(new SupportExprNode(typeof(int))); try { _bitWiseNode.Validate(SupportExprValidationContextFactory.MakeEmpty(_container)); Assert.Fail(); } catch (ExprValidationException) { // Expected } }
public void TestGetType() { Log.Debug(".testGetType"); _bitWiseNode = new ExprBitWiseNode(BitWiseOpEnum.BAND); _bitWiseNode.AddChildNode(new SupportExprNode(typeof(double?))); _bitWiseNode.AddChildNode(new SupportExprNode(typeof(int))); try { _bitWiseNode.Validate(SupportExprValidationContextFactory.MakeEmpty(_container)); Assert.Fail(); } catch (ExprValidationException) { // Expected } _bitWiseNode = new ExprBitWiseNode(BitWiseOpEnum.BAND); _bitWiseNode.AddChildNode(new SupportExprNode(typeof(long))); _bitWiseNode.AddChildNode(new SupportExprNode(typeof(long))); ExprNodeUtility.GetValidatedSubtree(ExprNodeOrigin.SELECT, _bitWiseNode, SupportExprValidationContextFactory.MakeEmpty(_container)); Assert.AreEqual(typeof(long?), _bitWiseNode.ReturnType); }