Skip to content

Commit 0364c97

Browse files
committed
[r] CodeMaid cleanup
1 parent 2345cd0 commit 0364c97

8 files changed

Lines changed: 15 additions & 16 deletions

File tree

src/Simplify.Web.Tests/Controllers/Execution/PreviousPageUrlUpdaterTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using System.Threading.Tasks;
3-
using Microsoft.AspNetCore.Http;
43
using Moq;
54
using NUnit.Framework;
65
using Simplify.Web.Controllers;

src/Simplify.Web.Tests/Controllers/Resolution/ControllerResolutionPipelineTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using Microsoft.AspNetCore.Http;
3-
using Microsoft.VisualBasic;
43
using Moq;
54
using NUnit.Framework;
65
using Simplify.Web.Controllers.Meta;
@@ -66,4 +65,4 @@ public void Execute_ThreeStagesSecondStopProcessing_TwoExecuted()
6665
stage2.Verify(x => x.Execute(It.IsAny<IControllerResolutionState>(), It.Is<HttpContext>(c => c == _context), It.IsAny<Action>()));
6766
stage3.Verify(x => x.Execute(It.IsAny<IControllerResolutionState>(), It.Is<HttpContext>(c => c == _context), It.IsAny<Action>()), Times.Never);
6867
}
69-
}
68+
}

src/Simplify.Web.Tests/Controllers/V2/Execution/TestTypes/NullResponseController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace Simplify.Web.Tests.Controllers.V2.Execution.TestTypes;
33
public class NullResponseController : Controller2
44
{
55
public bool Invoked { get; private set; }
6+
67
public ControllerResponse? Invoke()
78
{
89
Invoked = true;

src/Simplify.Web.Tests/Controllers/V2/Execution/TestTypes/StringResponseController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace Simplify.Web.Tests.Controllers.V2.Execution.TestTypes;
33
public class StringResponseController : Controller2
44
{
55
public bool Invoked { get; private set; }
6+
67
public virtual ControllerResponse Invoke()
78
{
89
Invoked = true;

src/Simplify.Web.Tests/Controllers/V2/Metadata/MetadataTests/TestTypes/VoidResultController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ namespace Simplify.Web.Tests.Controllers.V2.Metadata.MetadataTests.TestTypes;
22

33
public class VoidResultController : Controller2
44
{
5-
public void Invoke() { }
5+
public void Invoke()
6+
{ }
67
}

src/Simplify.Web/Controllers/V2/Metadata/Controller2Metadata.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ public Controller2Metadata(Type controllerType) : base(controllerType)
2727

2828
protected override IControllerRoute BuildControllerRoute(string path) => new Controller2Route(path, InvokeMethodParameters);
2929

30-
private MethodInfo BuildInvokeMethodInfo(string invokeMethodName) =>
31-
ControllerType.GetMethod(invokeMethodName)
32-
?? throw new InvalidOperationException($"Method {invokeMethodName} not found in class {ControllerType.Name}");
33-
3430
private static void ValidateReturnType(MethodInfo methodInfo)
3531
{
3632
if (!Controller2ValidReturnTypes.Types.Contains(methodInfo.ReturnType))
3733
throw new InvalidOperationException($"Invoke method invalid return type, can be one of: {Controller2ValidReturnTypes.Types.GetTypeNamesAsString()}");
3834
}
3935

36+
private MethodInfo BuildInvokeMethodInfo(string invokeMethodName) =>
37+
ControllerType.GetMethod(invokeMethodName)
38+
?? throw new InvalidOperationException($"Method {invokeMethodName} not found in class {ControllerType.Name}");
39+
4040
private IDictionary<string, Type> BuildInvokeMethodParameters() =>
4141
InvokeMethodInfo
4242
.GetParameters()

src/Simplify.Web/Diagnostics/Templates/Http500ErrorPage.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@ <h2>Internal Server Error</h2>
2222
</div>
2323
</div>
2424
</body>
25-
2625
</html>

src/Simplify.Web/Responses/Json.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,21 @@ namespace Simplify.Web.Responses;
1313
/// <param name="statusCode">The HTTP response status code.</param>
1414
public class Json(object objectToConvert, int statusCode = 200) : ControllerResponse
1515
{
16-
1716
/// <summary>
18-
/// Gets or sets the default JsonSerializerOptions
17+
/// Gets the HTTP response status code.
1918
/// </summary>
2019
/// <value>
21-
/// The default JsonSerializerOptions.
20+
/// The HTTP response status code.
2221
/// </value>
23-
public static JsonSerializerOptions? DefaultOptions { get; set; } = null;
22+
private readonly int _statusCode = statusCode;
2423

2524
/// <summary>
26-
/// Gets the HTTP response status code.
25+
/// Gets or sets the default JsonSerializerOptions
2726
/// </summary>
2827
/// <value>
29-
/// The HTTP response status code.
28+
/// The default JsonSerializerOptions.
3029
/// </value>
31-
private readonly int _statusCode = statusCode;
30+
public static JsonSerializerOptions? DefaultOptions { get; set; } = null;
3231

3332
/// <summary>
3433
/// Processes this response

0 commit comments

Comments
 (0)