mirror of https://github.com/AMT-Cheif/Stylet.git
Rename IValidatorAdapter back to IModelValidator, as the latter is more description of its end use
This commit is contained in:
parent
fe13725062
commit
d56f3b5c26
|
@ -10,13 +10,13 @@ namespace Stylet
|
|||
/// Generic version of IValidationArapter. Provided for use with StyletIoC
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Having a generic version allows you implement it using a generic ValidationAdapter (ValidationAdapter{T} : IValidationAdapter{T})
|
||||
/// Having a generic version allows you implement it using a generic ValidationAdapter (ValidationAdapter{T} : IModelValidator{T})
|
||||
/// then write a binding rule like this:
|
||||
/// builder.Bind(typeof(IValidationAdapter{})).ToAllImplementations()
|
||||
/// and request a new IValidationAdapter{MyViewModelType} in your ViewModel's constructor.
|
||||
/// </remarks>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public interface IValidatorAdapter<in T> : IValidatorAdapter
|
||||
public interface IModelValidator<in T> : IModelValidator
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace Stylet
|
|||
/// <remarks>
|
||||
/// This should be specialised to the particular ValidationModelBase instance it's validating
|
||||
/// </remarks>
|
||||
public interface IValidatorAdapter
|
||||
public interface IModelValidator
|
||||
{
|
||||
/// <summary>
|
||||
/// Called by ValidatingModelBase, which passes in an instance of itself.
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Stylet
|
|||
public class Screen : ValidatingModelBase, IScreen
|
||||
{
|
||||
public Screen() : base() { }
|
||||
public Screen(IValidatorAdapter validator) : base(validator) { }
|
||||
public Screen(IModelValidator validator) : base(validator) { }
|
||||
|
||||
#region WeakEventManager
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@ namespace Stylet
|
|||
|
||||
private readonly SemaphoreSlim propertyErrorsLock = new SemaphoreSlim(1, 1);
|
||||
private readonly Dictionary<string, string[]> propertyErrors = new Dictionary<string, string[]>();
|
||||
private IValidatorAdapter _validator;
|
||||
private IModelValidator _validator;
|
||||
|
||||
/// <summary>
|
||||
/// IValidationAdapter to use to validate properties. You're expected to write your own, using your favourite validation library
|
||||
/// IModelValidator to use to validate properties. You're expected to write your own, using your favourite validation library
|
||||
/// </summary>
|
||||
protected virtual IValidatorAdapter validator
|
||||
protected virtual IModelValidator validator
|
||||
{
|
||||
get { return this._validator; }
|
||||
set
|
||||
|
@ -55,7 +55,7 @@ namespace Stylet
|
|||
/// Instantiate, using the specified IValidatorAdapter
|
||||
/// </summary>
|
||||
/// <param name="validator">Validator adapter to use to perform validations</param>
|
||||
public ValidatingModelBase(IValidatorAdapter validator) : this()
|
||||
public ValidatingModelBase(IModelValidator validator) : this()
|
||||
{
|
||||
this.validator = validator;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace StyletUnitTests
|
|||
{
|
||||
private class MyScreen : Screen
|
||||
{
|
||||
public IValidatorAdapter Validator
|
||||
public IModelValidator Validator
|
||||
{
|
||||
get { return base.validator; }
|
||||
set { base.validator = value; }
|
||||
|
@ -29,7 +29,7 @@ namespace StyletUnitTests
|
|||
}
|
||||
|
||||
public MyScreen() { }
|
||||
public MyScreen(IValidatorAdapter validator) : base(validator) { }
|
||||
public MyScreen(IModelValidator validator) : base(validator) { }
|
||||
|
||||
public bool OnActivateCalled;
|
||||
protected override void OnActivate()
|
||||
|
@ -275,7 +275,7 @@ namespace StyletUnitTests
|
|||
[Test]
|
||||
public void PassesValidatorAdapter()
|
||||
{
|
||||
var adapter = new Mock<IValidatorAdapter>();
|
||||
var adapter = new Mock<IModelValidator>();
|
||||
var screen = new MyScreen(adapter.Object);
|
||||
Assert.AreEqual(adapter.Object, screen.Validator);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue