Equals() public method

public Equals ( object obj ) : bool
obj object
return bool
    public void Equals_ObjectIsNotASqlStatement ()
    {
      var dataInfo = new TestStreamedValueInfo (typeof (int));
      var selectProjection = Expression.Constant (1);
      var sqlStatement = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      Assert.That (sqlStatement.Equals (new object()), Is.False);
    }
    public void Equals_EqualStatementsWithAllMembers ()
    {
      var dataInfo = new TestStreamedValueInfo (typeof (int));
      var isDistinctQuery = BooleanObjectMother.GetRandomBoolean();
      var selectProjection = Expression.Constant (1);
      var sqlTable = new SqlTable (new ResolvedSimpleTableInfo (typeof (Cook), "CookTable", "c"), JoinSemantics.Inner);
      var ordering = new Ordering (Expression.Constant ("ordering"), OrderingDirection.Asc);
      var whereCondition = Expression.Constant (true);
      var topExpression = Expression.Constant ("top");
      var rowNumberSelector = Expression.Constant ("selector");
      var currentRowNumberOffset = Expression.Constant (1);
      var groupByExpression = Expression.Constant ("group");

      var sqlStatement1 = new SqlStatement (
          dataInfo,
          selectProjection,
          new[] { sqlTable },
          whereCondition,
          groupByExpression,
          new[] { ordering },
          topExpression,
          isDistinctQuery,
          rowNumberSelector,
          currentRowNumberOffset);

      var sqlStatement2 = new SqlStatement (
          dataInfo,
          selectProjection,
          new[] { sqlTable },
          whereCondition,
          groupByExpression,
          new[] { ordering },
          topExpression,
          isDistinctQuery,
          rowNumberSelector,
          currentRowNumberOffset);

      Assert.That (sqlStatement1.Equals (sqlStatement2), Is.True);
    }
    public void Equals_DifferentCurrentRowNumberOffset ()
    {
      var currentRowNumberOffset1 = Expression.Constant (1);
      var currentRowNumberOffset2 = Expression.Constant (2);
      var dataInfo = new TestStreamedValueInfo (typeof (int));
      var selectProjection = Expression.Constant (1);

      var sqlStatement1 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          currentRowNumberOffset1);

      var sqlStatement2 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          currentRowNumberOffset2);

      Assert.That (sqlStatement1.Equals (sqlStatement2), Is.False);
    }
    public void Equals_DifferentGroupByExpression ()
    {
      var groupByExpression1 = Expression.Constant ("group1");
      var groupByExpression2 = Expression.Constant ("group2");
      var dataInfo = new TestStreamedValueInfo (typeof (int));
      var selectProjection = Expression.Constant (1);

      var sqlStatement1 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          groupByExpression1,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      var sqlStatement2 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          groupByExpression2,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      Assert.That (sqlStatement1.Equals (sqlStatement2), Is.False);
    }
    public void Equals_DifferentDistinctCondition ()
    {
      var dataInfo = new TestStreamedValueInfo (typeof (int));
      var selectProjection = Expression.Constant (1);
      var isDistinctQuery = BooleanObjectMother.GetRandomBoolean();

      var sqlStatement1 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          isDistinctQuery,
          null,
          null);

      var sqlStatement2 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          !isDistinctQuery,
          null,
          null);

      Assert.That (sqlStatement1.Equals (sqlStatement2), Is.False);
    }
    public void Equals_DifferentRowNumberSelector ()
    {
      var rowNumberSelector1 = Expression.Constant ("selector1");
      var rowNumberSelector2 = Expression.Constant ("selector2");
      var dataInfo = new TestStreamedValueInfo (typeof (int));
      var selectProjection = Expression.Constant (1);

      var sqlStatement1 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          rowNumberSelector1,
          null);

      var sqlStatement2 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          rowNumberSelector2,
          null);

      Assert.That (sqlStatement1.Equals (sqlStatement2), Is.False);
    }
    public void DifferentAggregationModifier ()
    {
      var dataInfo = new TestStreamedValueInfo (typeof (int));
      var selectProjection = Expression.Constant (1);
      var selectProjectionWithCountAggregation = new AggregationExpression (typeof (int), selectProjection, AggregationModifier.Count);

      var sqlStatement1 = new SqlStatement (
          dataInfo,
          selectProjectionWithCountAggregation,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      var sqlStatement2 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      Assert.That (sqlStatement1.Equals (sqlStatement2), Is.False);
    }
    public void Equals_DifferentOrderings ()
    {
      var dataInfo = new TestStreamedValueInfo (typeof (int));
      var selectProjection = Expression.Constant (1);
      var ordering1 = new Ordering (Expression.Constant ("ordering1"), OrderingDirection.Asc);
      var ordering2 = new Ordering (Expression.Constant ("ordering2"), OrderingDirection.Desc);

      var sqlStatement1 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new[] { ordering1 },
          null,
          false,
          null,
          null);

      var sqlStatement2 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new[] { ordering2 },
          null,
          false,
          null,
          null);

      Assert.That (sqlStatement1.Equals (sqlStatement2), Is.False);
    }
    public void Equals_DifferentSqlTables ()
    {
      var dataInfo = new TestStreamedValueInfo (typeof (int));
      var selectProjection = Expression.Constant (1);
      var sqlTable1 = new SqlTable (new ResolvedSimpleTableInfo (typeof (Cook), "CookTable", "c"), JoinSemantics.Inner);
      var sqlTable2 = new SqlTable (new ResolvedSimpleTableInfo (typeof (Kitchen), "KitchenTable", "k"), JoinSemantics.Inner);

      var sqlStatement1 = new SqlStatement (
          dataInfo,
          selectProjection,
          new[] { sqlTable1 },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      var sqlStatement2 = new SqlStatement (
          dataInfo,
          selectProjection,
          new[] { sqlTable2 },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      Assert.That (sqlStatement1.Equals (sqlStatement2), Is.False);
    }
Ejemplo n.º 10
0
    public void Equals_DifferentDataInfo ()
    {
      var dataInfo1 = new TestStreamedValueInfo (typeof (int));
      var dataInfo2 = new TestStreamedValueInfo (typeof (char));
      var selectProjection = Expression.Constant (1);

      var sqlStatement1 = new SqlStatement (
          dataInfo1,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      var sqlStatement2 = new SqlStatement (
          dataInfo2,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      Assert.That (sqlStatement1.Equals (sqlStatement2), Is.False);
    }
Ejemplo n.º 11
0
    public void Equals_EqualStatementsWithMandatoryMembers ()
    {
      var dataInfo = new TestStreamedValueInfo (typeof (int));
      var selectProjection = Expression.Constant (1);

      var sqlStatement1 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      var sqlStatement2 = new SqlStatement (
          dataInfo,
          selectProjection,
          new SqlTable[] { },
          null,
          null,
          new Ordering[] { },
          null,
          false,
          null,
          null);

      Assert.That (sqlStatement1.Equals (sqlStatement2), Is.True);
    }