public void TestSelectStatementGroupAccept() { Mock <KoraliumSqlVisitor> mock = new Mock <KoraliumSqlVisitor>(); SelectStatementGroup selectStatementGroup = new SelectStatementGroup(); selectStatementGroup.Accept(mock.Object); mock.Verify(x => x.VisitSelectStatementGroup(selectStatementGroup)); }
public void TestSelectStatementGroupEquals() { SelectStatementGroup first = new SelectStatementGroup() { SelectStatement = new SelectStatement() { FromClause = new Clauses.FromClause() { TableReference = new FromTableReference() { TableName = "t" } } } }; SelectStatementGroup firstClone = new SelectStatementGroup() { SelectStatement = new SelectStatement() { FromClause = new Clauses.FromClause() { TableReference = new FromTableReference() { TableName = "t" } } } }; SelectStatementGroup second = new SelectStatementGroup() { SelectStatement = new SelectStatement() { FromClause = new Clauses.FromClause() { TableReference = new FromTableReference() { TableName = "t2" } } } }; //Equals Assert.IsTrue(Equals(first, firstClone)); Assert.IsFalse(Equals(first, null)); Assert.IsFalse(Equals(first, second)); Assert.IsFalse(Equals(first, "other type")); //Hash code Assert.AreEqual(first.GetHashCode(), firstClone.GetHashCode()); Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode()); }
public void TestVisitSelectStatementGroup() { Mock <SelectStatement> mock = new Mock <SelectStatement>(); SelectStatementGroup selectStatementGroup = new SelectStatementGroup() { SelectStatement = mock.Object }; KoraliumSqlVisitor koraliumSqlVisitor = new KoraliumSqlVisitor(); koraliumSqlVisitor.Visit(selectStatementGroup); mock.Verify(x => x.Accept(koraliumSqlVisitor)); }
public void TestCloneSelectStatementGroup() { SelectStatementGroup selectStatementGroup = new SelectStatementGroup() { SelectStatement = new SelectStatement() { FromClause = new Clauses.FromClause() { TableReference = new FromTableReference() { TableName = "t" } } } }; var clone = selectStatementGroup.Clone() as SelectStatementGroup; Assert.AreEqual(selectStatementGroup, clone); Assert.IsFalse(ReferenceEquals(selectStatementGroup, clone)); Assert.IsFalse(ReferenceEquals(selectStatementGroup.SelectStatement, clone.SelectStatement)); }
public void TestSelectStatementGroup() { var actual = new SelectStatementGroup() { SelectStatement = new SelectStatement() { SelectElements = new List <SelectExpression>() { new SelectNullExpression() } } }.Print(); var expected = "(SELECT NULL)"; actual.Should().Be(expected); }
public virtual void VisitSelectStatementGroup(SelectStatementGroup selectStatementGroup) { Visit(selectStatementGroup.SelectStatement); //DONE }