public void TestIsEqual_DecimalInt32_NotEqual() { Field sourceField = new LiteralField("Decimal", "sourceField", "2999"); Field targetField = new LiteralField("Int32", "targetField", "3000"); SimpleCondition condition = new IsEqual(sourceField, targetField); bool isHold = condition.IsSimpleConditonHold(null); bool expected = false; Assert.AreEqual <bool>(expected, isHold); }
public void TestIsEqual_DateTime_NotEqual() { Field sourceField = new LiteralField("DateTime", "sourceField", "2016-02-28"); Field targetField = new LiteralField("DateTime", "targetField", "2016-02-25"); SimpleCondition condition = new IsEqual(sourceField, targetField); bool isHold = condition.IsSimpleConditonHold(null); bool expected = false; Assert.AreEqual <bool>(expected, isHold); }
public void TestMultiplication_CurrentDate() { ComplexField addition = new Addition(); Field operand1 = new SpecialField("operand1", "CurrentDate"); Field operand2 = new LiteralField("Int32", "operand2", "-4"); Field operand3 = new LiteralField("Decimal", "operand3", "-1"); addition.AddField(operand1).AddField(operand2).AddField(operand3); DateTime additionResult = (DateTime)addition.GetValue(null); DateTime expected = DateTime.Now.Date.AddDays(-5); Assert.AreEqual <DateTime>(expected, additionResult); }
public void TestMultiplication_DecimalInt32() { ComplexField multiplication = new Multiplication(); Field operand1 = new LiteralField("Decimal", "operand1", "3000"); Field operand2 = new LiteralField("Int32", "operand2", "-1"); Field operand3 = new LiteralField("Decimal", "operand3", "3"); multiplication.AddField(operand1).AddField(operand2).AddField(operand3); Decimal multiplicationResult = (Decimal)multiplication.GetValue(null); Decimal expected = new Decimal(-9000); Assert.AreEqual <Decimal>(expected, multiplicationResult); }
public void TestIsEqual_DateTime_NotEqual_TableField() { Field sourceField = new LiteralField("DateTime", "sourceField", "2016-02-28"); Field targetField = new TableField("DateTime", "targetField"); SimpleCondition condition = new IsEqual(sourceField, targetField); IDataSourceStore dsStore = new DataSourceStore(); IDataSource ds = new TableDataSource(new Dictionary <string, object>() { { "targetField", "2016-02-27" } }); bool isHold = condition.IsSimpleConditonHold(dsStore.AddDataSource(ds)); bool expected = false; Assert.AreEqual <bool>(expected, isHold); }