Skip to content

Commit 0bf16e5

Browse files
committed
#283 Renaming of all related classes and interfaces to "With and without" model state.
1 parent 3d3105d commit 0bf16e5

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/MyTested.AspNetCore.Mvc.ModelState/Builders/Contracts/Models/IAndModelStateBuilder.cs renamed to src/MyTested.AspNetCore.Mvc.ModelState/Builders/Contracts/Models/IAndWithModelStateBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
/// <summary>
44
/// Used for adding AndAlso() method to the <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/> builder.
55
/// </summary>
6-
public interface IAndModelStateBuilder : IModelStateBuilder
6+
public interface IAndWithModelStateBuilder : IWithModelStateBuilder
77
{
88
/// <summary>
99
/// AndAlso method for better readability when building <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/>.
1010
/// </summary>
11-
/// <returns>The same <see cref="IModelStateBuilder"/>.</returns>
12-
IModelStateBuilder AndAlso();
11+
/// <returns>The same <see cref="IWithModelStateBuilder"/>.</returns>
12+
IWithModelStateBuilder AndAlso();
1313
}
1414
}

src/MyTested.AspNetCore.Mvc.ModelState/Builders/Contracts/Models/IModelStateBuilder.cs renamed to src/MyTested.AspNetCore.Mvc.ModelState/Builders/Contracts/Models/IWithModelStateBuilder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
/// <summary>
66
/// Used for building <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/>.
77
/// </summary>
8-
public interface IModelStateBuilder
8+
public interface IWithModelStateBuilder
99
{
1010
/// <summary>
1111
/// Adds an error to the built <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/>
1212
/// </summary>
1313
/// <param name="key">Key to set as string.</param>
1414
/// <param name="errorMessage">Error message to set as string.</param>
1515
/// <returns></returns>
16-
IAndModelStateBuilder WithError(string key, string errorMessage);
16+
IAndWithModelStateBuilder WithError(string key, string errorMessage);
1717

1818
/// <summary>
1919
/// Adds model state entries to the built <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/>
2020
/// </summary>
2121
/// <param name="errors">Model state entries as dictionary.</param>
2222
/// <returns></returns>
23-
IAndModelStateBuilder WithErrors(IDictionary<string, string> errors);
23+
IAndWithModelStateBuilder WithErrors(IDictionary<string, string> errors);
2424

2525
/// <summary>
2626
/// Adds model state entries to the built <see cref="Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"/>
2727
/// </summary>
2828
/// <param name="errors">Model state entries as anonymous object.</param>
2929
/// <returns></returns>
30-
IAndModelStateBuilder WithErrors(object errors);
30+
IAndWithModelStateBuilder WithErrors(object errors);
3131
}
3232
}

src/MyTested.AspNetCore.Mvc.ModelState/Builders/Models/ModelStateBuilder.cs renamed to src/MyTested.AspNetCore.Mvc.ModelState/Builders/Models/WithModelStateBuilder.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,33 @@
1010
/// <summary>
1111
/// Used for building <see cref="ModelStateDictionary"/>
1212
/// </summary>
13-
public class ModelStateBuilder : BaseModelStateBuilder, IAndModelStateBuilder
13+
public class WithModelStateBuilder : BaseModelStateBuilder, IAndWithModelStateBuilder
1414
{
1515
/// <summary>
16-
/// Initializes a new instance of the <see cref="ModelStateBuilder"/> class.
16+
/// Initializes a new instance of the <see cref="WithModelStateBuilder"/> class.
1717
/// </summary>
1818
/// <param name="actionContext"><see cref="ModelStateDictionary"/> to build.</param>
19-
public ModelStateBuilder(ActionTestContext actionContext)
19+
public WithModelStateBuilder(ActionTestContext actionContext)
2020
: base(actionContext)
2121
{
2222
}
2323

2424
/// <inheritdoc />
25-
public IAndModelStateBuilder WithError(string key, string errorMessage)
25+
public IAndWithModelStateBuilder WithError(string key, string errorMessage)
2626
{
2727
this.AddError(key, errorMessage);
2828
return this;
2929
}
3030

3131
/// <inheritdoc />
32-
public IAndModelStateBuilder WithErrors(IDictionary<string, string> errors)
32+
public IAndWithModelStateBuilder WithErrors(IDictionary<string, string> errors)
3333
{
3434
errors.ForEach(err => this.AddError(err.Key, err.Value));
3535
return this;
3636
}
3737

3838
/// <inheritdoc />
39-
public IAndModelStateBuilder WithErrors(object errors)
39+
public IAndWithModelStateBuilder WithErrors(object errors)
4040
{
4141
var errorsAsDictionary = new RouteValueDictionary(errors);
4242
errorsAsDictionary
@@ -46,7 +46,7 @@ public IAndModelStateBuilder WithErrors(object errors)
4646
}
4747

4848
/// <inheritdoc />
49-
public IModelStateBuilder AndAlso() => this;
49+
public IWithModelStateBuilder AndAlso() => this;
5050

5151
private void AddError(string key, string errorMessage)
5252
=> this.ModelState.AddModelError(key, errorMessage);

src/MyTested.AspNetCore.Mvc.ModelState/ComponentBuilderModelStateWithExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ public static class ComponentBuilderModelStateWithExtensions
1414
{
1515
public static TBuilder WithModelState<TBuilder>(
1616
this IBaseTestBuilderWithComponentBuilder<TBuilder> builder,
17-
Action<IModelStateBuilder> modelStateTestBuilder)
17+
Action<IWithModelStateBuilder> modelStateTestBuilder)
1818
where TBuilder : IBaseTestBuilder
1919
{
2020
var actualBuilder = (BaseTestBuilderWithComponentBuilder<TBuilder>)builder;
2121

22-
modelStateTestBuilder(new ModelStateBuilder(actualBuilder.TestContext as ActionTestContext));
22+
modelStateTestBuilder(new WithModelStateBuilder(actualBuilder.TestContext as ActionTestContext));
2323

2424
return actualBuilder.Builder;
2525
}

0 commit comments

Comments
 (0)