public async Task GetWhereClauseSimple(DbColumn col, object val, string nullClause)
        {
            // Setup: Create a result set and metadata provider with a single column
            var       cols = new[] { col };
            ResultSet rs   = await GetResultSet(cols, new[] { val });

            EditTableMetadata etm = Common.GetStandardMetadata(cols);

            RowEditTester rt = new RowEditTester(rs, etm);

            rt.ValidateWhereClauseSingleKey(nullClause);
        }
        public async Task GetWhereClauseNoKeyColumns()
        {
            // Setup: Create a result set and metadata provider with no key columns
            DbColumn[] cols = { new TestDbColumn("col1"), new TestDbColumn("col2") };
            ResultSet  rs   = await GetResultSet(cols, new object[] { "abc", "def" });

            EditTableMetadata etm = Common.GetStandardMetadata(new DbColumn[] {});

            RowEditTester rt = new RowEditTester(rs, etm);

            rt.ValidateWhereClauseNoKeys();
        }
        public async Task ValidateUpdatableColumnNotUpdatable()
        {
            // Setup: Create a result set with an identity column
            var rs = await GetResultSet(
                new DbColumn[] {
                new TestDbColumn("id")
                {
                    IsKey = true, IsAutoIncrement = true, IsIdentity = true
                },
                new TestDbColumn("col1")
            },
                new object[] { "id", "1" });

            var etm = Common.GetStandardMetadata(rs.Columns);

            // If: I validate a column ID that is not updatable
            // Then: It should throw
            RowEditTester tester = new RowEditTester(rs, etm);

            Assert.Throws <InvalidOperationException>(() => tester.ValidateColumn(0));
        }
        [InlineData(100)]       // Index larger than number of columns
        public async Task ValidateUpdatableColumnOutOfRange(int columnId)
        {
            // Setup: Create a result set
            var rs = await GetResultSet(
                new DbColumn[] {
                new TestDbColumn("id")
                {
                    IsKey = true, IsAutoIncrement = true, IsIdentity = true
                },
                new TestDbColumn("col1")
            },
                new object[] { "id", "1" });

            var etm = Common.GetStandardMetadata(rs.Columns);

            // If: I validate a column ID that is out of range
            // Then: It should throw
            RowEditTester tester = new RowEditTester(rs, etm);

            Assert.Throws <ArgumentOutOfRangeException>(() => tester.ValidateColumn(columnId));
        }