Esempio n. 1
0
        public void should_return_zero_when_comparing_rows_if_column_does_not_exist()
        {
            var xRow = new JsonGridRow();
            var yRow = new JsonGridRow();

            RowComparer
                .CompareRows("Test", xRow, yRow)
                .ShouldEqual(0);
        }
Esempio n. 2
0
        public static int CompareRows(string columnName, JsonGridRow x, JsonGridRow y)
        {
            var xCol = x.FindColumn(columnName);
            var yCol = y.FindColumn(columnName);
            if (xCol == null || yCol == null)
            {
                return 0;
            }

            return xCol.Value.CompareTo(yCol.Value);
        }
Esempio n. 3
0
        public void should_compare_column_values_when_columns_exist()
        {
            var colName = "Test";
            var xRow = new JsonGridRow
                           {
                               Columns = new List<JsonGridColumn> {new JsonGridColumn {Name = colName, Value = "Column 2"}}
                           };
            var yRow = new JsonGridRow
                           {
                               Columns =
                                   new List<JsonGridColumn> {new JsonGridColumn {Name = colName, Value = "Column 1"}}
                           };

            RowComparer
                .CompareRows(colName, xRow, yRow)
                .ShouldEqual(1);
        }