public void Evaluate_WithRegexInExpression_ReturnsFalse() { var dynamicFilter = new DynamicStockFilter("Regex.IsMatch(Stock.Identifier, \"(?i)^[ABC]\")"); var stock = new SpreadBet.Domain.Stock { Identifier = "XYZ.L" }; var result = dynamicFilter.Evaluate(stock); Assert.IsFalse(result); }
public void Evaluate_ExpressionDoesNotContainStockReference_ResolvesStockProperty() { var dynamicFilter = new DynamicStockFilter("Identifier == \"ABC.L\""); var stock = new SpreadBet.Domain.Stock { Identifier = "ABC.L" }; var result = dynamicFilter.Evaluate(stock); Assert.IsTrue(result); }
public void Evaluate_WithValidExpression_ReturnsTrue() { var dynamicFilter = new DynamicStockFilter("Stock.Identifier.ToUpper().SubString(0,1) = \"A\""); var stock = new SpreadBet.Domain.Stock { Identifier = "ABC.L" }; var result = dynamicFilter.Evaluate(stock); Assert.IsTrue(result); }