Пример #1
0
        public void CompareFromNullRowThrowsException()
        {
            ResultSetRow row = null;

            Assert.ThrowsException <ArgumentNullException>(() =>
            {
                row.EqualRows(new ResultSetRow());
            }, "r2");
        }
Пример #2
0
        public void CanCompareRows()
        {
            var row1 = new ResultSetRow();

            row1["cola"] = "hello";
            row1["colb"] = DBNull.Value;
            row1["colc"] = null;
            row1["cold"] = DBNull.Value;

            var row2 = new ResultSetRow();

            row2["cola"] = "hello";
            row2["colb"] = DBNull.Value;
            row2["colc"] = null;
            row2["cold"] = null;


            Assert.IsTrue(row1.EqualRows(row2));
            Assert.IsTrue(row2.EqualRows(row1));

            row2["cold"] = "check";
            Assert.IsFalse(row1.EqualRows(row2));
            Assert.IsFalse(row2.EqualRows(row1));
        }
Пример #3
0
        public void RowsDoNotEqualWithDifferentCountOfColumns()
        {
            var row1 = new ResultSetRow();

            row1["cola"] = "hello";
            row1["colb"] = DBNull.Value;

            var row2 = new ResultSetRow();

            row2["cola"] = "hello";
            row2["colb"] = DBNull.Value;
            row2["colc"] = null;

            Assert.IsFalse(row1.EqualRows(row2));
            Assert.IsFalse(row2.EqualRows(row1));
        }
        public void CanEquateRows()
        {
            var row1 = new ResultSetRow();
            var row2 = new ResultSetRow();

            Assert.IsTrue(row1.EqualRows(row2));

            row1["cola"] = 12;
            Assert.IsFalse(row1.EqualRows(row2));
            row2["cola"] = 11;
            Assert.IsFalse(row1.EqualRows(row2));
            row2["cola"] = 12;
            Assert.IsTrue(row1.EqualRows(row2));

            row1["colb"] = null;
            Assert.IsFalse(row1.EqualRows(row2));
            row2["colb"] = null;
            Assert.IsTrue(row1.EqualRows(row2));

            row1["cold"] = null;
            row2["cold"] = "abc";
            Assert.IsFalse(row1.EqualRows(row2));

            row1["cold"] = "def";
            row2["cold"] = null;
            Assert.IsFalse(row1.EqualRows(row2));
            row2["cold"] = "def";
            Assert.IsTrue(row1.EqualRows(row2));

            row1["colc"] = DBNull.Value;
            Assert.IsFalse(row1.EqualRows(row2));
            row2["colc"] = DBNull.Value;
            Assert.IsTrue(row1.EqualRows(row2));

            row2["colc"] = 12.6m;
            Assert.IsFalse(row1.EqualRows(row2));
            row1["colc"] = 14.6m;
            row2["colc"] = DBNull.Value;
            Assert.IsFalse(row1.EqualRows(row2));
        }