Refactor project files for improved readability and structure
- Cleaned up whitespace in Directory.Build.props and Directory.Packages.props for consistency. - Reformatted project file references in PnvPanel.Api.csproj for better clarity. - Enhanced code readability in various endpoint files by adjusting line breaks and indentation. - Standardized method signatures and improved formatting in ResultExtensions and multiple endpoint classes for better maintainability.
This commit is contained in:
+43
-7
@@ -21,9 +21,20 @@ public class RegisterNodeCommandHandlerTests
|
||||
_gateway.ValidateBaseAddress(Arg.Any<Uri>()).Returns(Result.Success());
|
||||
_secretProtector.Protect("secret-password").Returns("protected-secret-password");
|
||||
|
||||
var handler = new RegisterNodeCommandHandler(dbContext, _gateway, _secretProtector, _currentUser);
|
||||
var handler = new RegisterNodeCommandHandler(
|
||||
dbContext,
|
||||
_gateway,
|
||||
_secretProtector,
|
||||
_currentUser
|
||||
);
|
||||
|
||||
var command = new RegisterNodeCommand("node-1", "https://node1.example.com", "admin", "secret-password", "eu-west");
|
||||
var command = new RegisterNodeCommand(
|
||||
"node-1",
|
||||
"https://node1.example.com",
|
||||
"admin",
|
||||
"secret-password",
|
||||
"eu-west"
|
||||
);
|
||||
|
||||
var result = await handler.Handle(command, CancellationToken.None);
|
||||
|
||||
@@ -31,7 +42,10 @@ public class RegisterNodeCommandHandlerTests
|
||||
Assert.Equal("node-1", result.Value.Name);
|
||||
Assert.Equal("admin", result.Value.Username);
|
||||
Assert.Single(dbContext.Nodes.Local);
|
||||
Assert.Equal("protected-secret-password", dbContext.Nodes.Local.Single().Credentials.ProtectedPassword);
|
||||
Assert.Equal(
|
||||
"protected-secret-password",
|
||||
dbContext.Nodes.Local.Single().Credentials.ProtectedPassword
|
||||
);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -39,9 +53,20 @@ public class RegisterNodeCommandHandlerTests
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
|
||||
var handler = new RegisterNodeCommandHandler(dbContext, _gateway, _secretProtector, _currentUser);
|
||||
var handler = new RegisterNodeCommandHandler(
|
||||
dbContext,
|
||||
_gateway,
|
||||
_secretProtector,
|
||||
_currentUser
|
||||
);
|
||||
|
||||
var command = new RegisterNodeCommand("node-1", "not-a-uri", "admin", "secret-password", null);
|
||||
var command = new RegisterNodeCommand(
|
||||
"node-1",
|
||||
"not-a-uri",
|
||||
"admin",
|
||||
"secret-password",
|
||||
null
|
||||
);
|
||||
|
||||
var result = await handler.Handle(command, CancellationToken.None);
|
||||
|
||||
@@ -59,9 +84,20 @@ public class RegisterNodeCommandHandlerTests
|
||||
var error = Error.Validation("Nodes.SchemeNotAllowed", "Разрешён только HTTPS.");
|
||||
_gateway.ValidateBaseAddress(Arg.Any<Uri>()).Returns(Result.Failure(error));
|
||||
|
||||
var handler = new RegisterNodeCommandHandler(dbContext, _gateway, _secretProtector, _currentUser);
|
||||
var handler = new RegisterNodeCommandHandler(
|
||||
dbContext,
|
||||
_gateway,
|
||||
_secretProtector,
|
||||
_currentUser
|
||||
);
|
||||
|
||||
var command = new RegisterNodeCommand("node-1", "http://node1.example.com", "admin", "secret-password", null);
|
||||
var command = new RegisterNodeCommand(
|
||||
"node-1",
|
||||
"http://node1.example.com",
|
||||
"admin",
|
||||
"secret-password",
|
||||
null
|
||||
);
|
||||
|
||||
var result = await handler.Handle(command, CancellationToken.None);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user