public async Task RevertCellThatWasSet(int defaultCols) { // Setup: // ... Generate the parameters for the row create Common.TestDbColumnsWithTableMetadata data = new Common.TestDbColumnsWithTableMetadata(false, false, defaultCols, 0); ResultSet rs = await Common.GetResultSet(data.DbColumns, false); RowCreate rc = new RowCreate(100, rs, data.TableMetadata); rc.SetCell(0, "1"); // If: I attempt to revert a cell that was set EditRevertCellResult result = rc.RevertCell(0); // Then: // ... We should get a result back Assert.NotNull(result); // ... We should get back an edit cell with a value based on the default value string expectedDisplayValue = defaultCols > 0 ? Common.DefaultValue : string.Empty; Assert.NotNull(result.Cell); Assert.Equal(expectedDisplayValue, result.Cell.DisplayValue); Assert.False(result.Cell.IsNull); // TODO: Modify to support null defaults // ... The row should be dirty Assert.True(result.IsRowDirty); // ... The cell should no longer be set Assert.Null(rc.newCells[0]); }
[InlineData(100)] // Way too large value public async Task RevertCellOutOfRange(int columnId) { // Setup: Generate the row create RowCreate rc = await GetStandardRowCreate(); // If: I attempt to revert a cell that is out of range // Then: I should get an exception Assert.Throws <ArgumentOutOfRangeException>(() => rc.RevertCell(columnId)); }
public async Task RevertCellNotSet() { // Setup: Generate the row create RowCreate rc = await GetStandardRowCreate(); // If: I attempt to revert a cell that has not been set EditRevertCellResult result = rc.RevertCell(0); // Then: // ... We should get a result back Assert.NotNull(result); // ... We should get a null cell back // @TODO: Check for a default value when we support it Assert.Null(result.Cell); // ... The row should be dirty Assert.True(result.IsRowDirty); // ... The cell should no longer be set Assert.Null(rc.newCells[0]); }