Implement DeleteRowObject functionality#291
Merged
scottolsonjr merged 5 commits intomainfrom Feb 14, 2026
Merged
Conversation
…onding unit tests
Contributor
There was a problem hiding this comment.
Pull request overview
Implements “DeleteRowObject” support across the RarelySimple.AvatarScriptLink.Net decorator layer (OptionObject variants + FormObject) so callers can mark rows for deletion by RowId, and adds unit tests validating the new behavior.
Changes:
- Refactors legacy
OptionObjectHelpers.DeleteRowObjectto useFindIndexfor locating the target form/row. - Adds
DeleteRowObjectAPIs toFormObjectDecoratorand allOptionObject*Decoratorvariants, wiring through their helper classes. - Adds MSTest coverage for successful deletion and common error cases.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/RarelySimple.AvatarScriptLink/Helpers/OptionObject/DeleteRowObject.cs | Refactors row deletion lookup logic in legacy helpers. |
| dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObjectDecoratorHelper.cs | Adds helper method to delete a row within a specified form in OptionObjectDecorator. |
| dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObjectDecorator.cs | Exposes DeleteRowObject(formId, rowId) on OptionObjectDecorator. |
| dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObject2DecoratorHelper.cs | Adds helper method to delete a row within a specified form in OptionObject2Decorator. |
| dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObject2Decorator.cs | Exposes DeleteRowObject(formId, rowId) on OptionObject2Decorator. |
| dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObject2015DecoratorHelper.cs | Adds helper method to delete a row within a specified form in OptionObject2015Decorator. |
| dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObject2015Decorator.cs | Exposes DeleteRowObject(formId, rowId) on OptionObject2015Decorator. |
| dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/FormObjectDecoratorHelper.cs | Implements row deletion behavior (current row + other rows). |
| dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/FormObjectDecorator.cs | Exposes DeleteRowObject overloads on FormObjectDecorator. |
| dotnet/RarelySimple.AvatarScriptLink.Net.Tests/Decorators/OptionObjectDecoratorTests.cs | Adds tests for OptionObjectDecorator row deletion and error cases. |
| dotnet/RarelySimple.AvatarScriptLink.Net.Tests/Decorators/OptionObject2DecoratorTests.cs | Adds tests for OptionObject2Decorator row deletion and error cases. |
| dotnet/RarelySimple.AvatarScriptLink.Net.Tests/Decorators/OptionObject2015DecoratorTests.cs | Adds tests for OptionObject2015Decorator row deletion and error cases. |
| dotnet/RarelySimple.AvatarScriptLink.Net.Tests/Decorators/FormObjectDecoratorTests.cs | Adds tests for FormObjectDecorator row deletion (current + other rows + errors). |
dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObject2015DecoratorHelper.cs
Outdated
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink/Helpers/OptionObject/DeleteRowObject.cs
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObjectDecoratorHelper.cs
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObjectDecoratorHelper.cs
Outdated
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObject2DecoratorHelper.cs
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObject2DecoratorHelper.cs
Outdated
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObject2015DecoratorHelper.cs
Show resolved
Hide resolved
…cuteOnForm helper for improved code reuse and clarity
…ks for Forms property
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
dotnet/RarelySimple.AvatarScriptLink/Helpers/OptionObject/DeleteRowObject.cs:74
- Missing null check for formObject parameter. Similar methods in the codebase, such as AddRowObject (line 43-44 in AddRowObject.cs), include a null check for the formObject parameter before accessing its properties. Add a null check: if (formObject == null) throw new ArgumentNullException(nameof(formObject), ...);
public static IFormObject DeleteRowObject(IFormObject formObject, string rowId)
{
if (string.IsNullOrEmpty(rowId))
throw new ArgumentNullException(nameof(rowId), ScriptLinkHelpers.GetLocalizedString(ParameterCannotBeNull, CultureInfo.CurrentCulture));
if (formObject.CurrentRow?.RowId == rowId)
{
formObject.CurrentRow.RowAction = RowAction.Delete;
return formObject;
}
if (formObject.MultipleIteration)
{
int rowIndex = formObject.OtherRows.FindIndex(r => r.RowId == rowId);
if (rowIndex >= 0)
{
formObject.OtherRows[rowIndex].RowAction = RowAction.Delete;
return formObject;
}
}
throw new ArgumentException(ScriptLinkHelpers.GetLocalizedString("noRowObjectsFoundByRowId", CultureInfo.CurrentCulture), nameof(rowId));
}
dotnet/RarelySimple.AvatarScriptLink/Helpers/OptionObject/DeleteRowObject.cs
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink.Net.Tests/Decorators/OptionObjectDecoratorTests.cs
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink.Net.Tests/Decorators/OptionObject2DecoratorTests.cs
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink.Net.Tests/Decorators/OptionObject2015DecoratorTests.cs
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink.Net/Decorators/OptionObject2015Decorator.cs
Show resolved
Hide resolved
dotnet/RarelySimple.AvatarScriptLink/Helpers/OptionObject/DeleteRowObject.cs
Show resolved
Hide resolved
…ity with corresponding tests
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Implement DeleteRowObject functionality in decorators and add corresponding unit tests