public void TestLessOperatorWithInt_SecondIntIsLesserThanFirstInt_EvaluationReturnFalse() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.LessKey); int i = 2; int j = 1; Assert.IsTrue(!(i < j)); Assert.IsFalse(op.evaluate(i, j)); }
public void TestEqualOperator_WithTwoEqualDouble_EvaluationReturnTrue() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.EqualKey); double d1 = 1.3; double d2 = 1.3; Assert.AreEqual(d1, d2); Assert.IsTrue(op.evaluate(d1, d2)); }
public void TestEqualOperator_WithTwoDiferentDouble_EvaluationReturnFalse() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.EqualKey); double d1 = 1.3; double d2 = d1 + 1.3; Assert.AreNotEqual(d1, d2); Assert.IsFalse(op.evaluate(d1, d2)); }
public void TestEqualOperator_WithTwoEqualString_EvaluationReturnTrue() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.EqualKey); string st1 = "a"; string st2 = "a"; Assert.AreEqual(st1, st2); Assert.IsTrue(op.evaluate(st1, st2)); }
public void TestEqualOperator_WithTwoDiferentString_EvaluationReturnFalse() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.EqualKey); string st1 = "a"; string st2 = st1 + "a"; Assert.AreNotEqual(st1, st2); Assert.IsFalse(op.evaluate(st1, st2)); }
public void TestHigherOperatorWithInt_SecondIntIsHigherThanFirstInt_EvaluationReturnFalse() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.HigherKey); int i = 1; int j = 2; Assert.IsTrue(!(i > j)); //Tactical ! (are ! are tactical) Assert.IsFalse(op.evaluate(i, j)); }
public void TestEqualOperator_WithTwoDiferentInt_EvaluationReturnFalse() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.EqualKey); int i = 1; int j = i + 1; Assert.AreNotEqual(i, j); Assert.IsFalse(op.evaluate(i, j)); }
public void TestHigherOperatorWithDouble_SecondDoubleIsHigherThanFirstDouble_EvaluationReturnFalse() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.HigherKey); double d1 = 1.1; double d2 = 2.2; Assert.IsTrue(!(d1 > d2)); Assert.IsFalse(op.evaluate(d1, d2)); }
public void TestEqualOperator_WithTwoEqualInt_EvaluationReturnTrue() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.EqualKey); int i = 1; int j = 1; Assert.AreEqual(i, j); Assert.IsTrue(op.evaluate(i, j)); }
public void TestHigherOperatorWithInt_FirstIntIsHigherThanSecondInt_EvaluationReturnTrue() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.HigherKey); int i = 2; int j = 1; Assert.IsTrue(i > j); Assert.IsTrue(op.evaluate(i, j)); }
public void TestLessOperatorWithDouble_SecondDoubleIsLesserThanFirstDouble_EvaluationReturnTrue() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.LessKey); double d1 = 2.2; double d2 = 1.2; Assert.IsTrue(!(d1 < d2)); Assert.IsFalse(op.evaluate(d1, d2)); }
public void TestHigherOperatorWithString_SecondStringIsHigherThanFirstString_ReturnFalse() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.HigherKey); string st2 = "ha"; string st1 = VariousFunctions.GenerateRandomString(st2.Length); while (!(st2.CompareTo(st1) == 1)) { st1 = VariousFunctions.GenerateRandomString(st2.Length); } Assert.AreEqual(1, st2.CompareTo(st1)); Assert.IsFalse(op.evaluate(st1, st2)); }
public void TestLessOperatorWithString_FirstStringIsLesserThanSecondString_ReturnTrue() { Operator op = OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.LessKey); string st1 = "aa"; string st2 = VariousFunctions.GenerateRandomString(st1.Length); while (!(st1.CompareTo(st2) == -1)) { st2 = VariousFunctions.GenerateRandomString(st1.Length); } Assert.AreEqual(-1, st1.CompareTo(st2)); //I dont trust nothing Assert.IsTrue(op.evaluate(st1, st2)); }
public void UpdateFKColumn_GoodArguments_DoTheUpdate() { // C phase IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer(); Database database = new Database("database"); Table table1 = new Table("t1"); Column c1table1 = new Column("column1", DataTypesFactory.GetDataTypesFactory().GetDataType(TypesKeyConstants.StringTypeKey)); table1.AddColumn(c1table1); table1.primaryKey.AddKey(c1table1); Table table2 = new Table("t2"); Column c1table2 = new Column("column1", DataTypesFactory.GetDataTypesFactory().GetDataType(TypesKeyConstants.StringTypeKey)); table2.AddColumn(c1table2); table2.foreignKey.AddForeignKey(c1table2, c1table1); Row r1 = table1.CreateRowDefinition(); r1.GetCell(c1table1.columnName).data = "asda"; table1.AddRow(r1); Row r2 = table1.CreateRowDefinition(); r2.GetCell(c1table1.columnName).data = r1.GetCell(c1table1.columnName).data + "a"; table1.AddRow(r2); Row r3 = table2.CreateRowDefinition(); r3.GetCell(c1table2.columnName).data = r1.GetCell(c1table1.columnName).data; table2.AddRow(r3); database.AddTable(table1); database.AddTable(table2); databaseContainer.AddDatabase(database); // T phase Update update = CreateUpdate(databaseContainer, database.databaseName, table2.tableName); update.AddValue(c1table2.columnName, r2.GetCell(c1table2.columnName).data); update.whereClause.AddCritery(c1table2.columnName, r3.GetCell(c1table2.columnName).data, OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.EqualKey)); Assert.IsTrue(update.ValidateParameters()); }
public void UpdatePKColumn_ThisIsIlegal_NoticeInValidate() { // C phase IDatabaseContainer databaseContainer = ObjectConstructor.CreateDatabaseContainer(); Database database = new Database("database"); Table table1 = new Table("t1"); Column c1 = new Column("column1", DataTypesFactory.GetDataTypesFactory().GetDataType(TypesKeyConstants.StringTypeKey)); table1.AddColumn(c1); table1.primaryKey.AddKey(c1); Row row = table1.CreateRowDefinition(); row.GetCell(c1.columnName).data = "data"; table1.AddRow(row); Row row2 = table1.CreateRowDefinition(); row.GetCell(c1.columnName).data = row.GetCell(c1.columnName).data + "a"; table1.AddRow(row2); database.AddTable(table1); databaseContainer.AddDatabase(database); // T phase Update update = CreateUpdate(databaseContainer, database.databaseName, table1.tableName); update.AddValue(c1.columnName, row2.GetCell(c1.columnName).data); update.whereClause.AddCritery(c1.columnName, row.GetCell(c1.columnName).data, OperatorFactory.GetOperatorFactory().GetOperator(OperatorKeys.EqualKey)); Assert.IsFalse(update.ValidateParameters()); }
public static OperatorFactory GetOperatorFactory() { return(OperatorFactory.GetOperatorFactory()); }