예제 #1
0
        public void TestCloneSearchExpression()
        {
            SearchExpression searchExpression = new SearchExpression()
            {
                AllColumns = false,
                Columns    = new List <ColumnReference>()
                {
                    new ColumnReference()
                    {
                        Identifiers = new List <string>()
                        {
                            "c1"
                        }
                    }
                },
                Value = new StringLiteral()
                {
                    Value = "test"
                }
            };

            var clone = searchExpression.Clone() as SearchExpression;

            Assert.AreEqual(searchExpression, clone);
            Assert.IsFalse(ReferenceEquals(searchExpression, clone));
            Assert.IsFalse(ReferenceEquals(searchExpression.Value, clone.Value));

            for (int i = 0; i < searchExpression.Columns.Count; i++)
            {
                Assert.IsFalse(ReferenceEquals(searchExpression.Columns[i], clone.Columns[i]));
            }
        }