feat(configmanager): add SearchFormViewModel

Implements Task 18 from phases 7-9 plan. SearchFormViewModel wraps
SearchSection model with properties for MaxResultRows, TimeoutSeconds,
and MaxConcurrentSearches. Includes full test coverage with 7 tests
verifying initialization, two-way binding, change notification, and
null argument handling.
This commit is contained in:
Joseph Doherty
2026-01-19 19:45:07 -05:00
parent 64518c7000
commit cc555e4e34
2 changed files with 177 additions and 0 deletions
@@ -0,0 +1,69 @@
using JdeScoping.ConfigManager.Models;
namespace JdeScoping.ConfigManager.ViewModels.Forms;
/// <summary>
/// ViewModel for editing Search configuration section.
/// </summary>
public class SearchFormViewModel : ViewModelBase
{
private readonly SearchSection _model;
private readonly Action _onChanged;
public SearchFormViewModel(SearchSection model, Action onChanged)
{
_model = model ?? throw new ArgumentNullException(nameof(model));
_onChanged = onChanged ?? throw new ArgumentNullException(nameof(onChanged));
}
/// <summary>
/// Gets or sets the maximum number of result rows returned by a search.
/// </summary>
public int MaxResultRows
{
get => _model.MaxResultRows;
set
{
if (_model.MaxResultRows != value)
{
_model.MaxResultRows = value;
OnPropertyChanged();
_onChanged();
}
}
}
/// <summary>
/// Gets or sets the timeout in seconds for search operations.
/// </summary>
public int TimeoutSeconds
{
get => _model.TimeoutSeconds;
set
{
if (_model.TimeoutSeconds != value)
{
_model.TimeoutSeconds = value;
OnPropertyChanged();
_onChanged();
}
}
}
/// <summary>
/// Gets or sets the maximum number of concurrent search operations allowed.
/// </summary>
public int MaxConcurrentSearches
{
get => _model.MaxConcurrentSearches;
set
{
if (_model.MaxConcurrentSearches != value)
{
_model.MaxConcurrentSearches = value;
OnPropertyChanged();
_onChanged();
}
}
}
}