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:
+47
-10
@@ -21,9 +21,18 @@ public class CreateBugReportTicketCommandHandlerTests
|
||||
var userId = Guid.NewGuid();
|
||||
var currentUser = FakeCurrentUser.Authenticated(userId, "alice");
|
||||
|
||||
var handler = new CreateBugReportTicketCommandHandler(dbContext, _fileStorage, _notifier, _telegramNotifier, currentUser);
|
||||
var handler = new CreateBugReportTicketCommandHandler(
|
||||
dbContext,
|
||||
_fileStorage,
|
||||
_notifier,
|
||||
_telegramNotifier,
|
||||
currentUser
|
||||
);
|
||||
|
||||
var result = await handler.Handle(new CreateBugReportTicketCommand("Что-то сломалось", []), CancellationToken.None);
|
||||
var result = await handler.Handle(
|
||||
new CreateBugReportTicketCommand("Что-то сломалось", []),
|
||||
CancellationToken.None
|
||||
);
|
||||
await dbContext.SaveChangesAsync(CancellationToken.None);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
@@ -33,8 +42,14 @@ public class CreateBugReportTicketCommandHandlerTests
|
||||
Assert.Equal("Что-то сломалось", result.Value.Comments[0].Body);
|
||||
Assert.Single(dbContext.SupportTickets);
|
||||
Assert.Single(dbContext.TicketComments);
|
||||
await _telegramNotifier.Received(1).NotifyAdminsBugReportCreatedAsync(
|
||||
Arg.Any<Guid>(), "alice", "Что-то сломалось", Arg.Any<CancellationToken>());
|
||||
await _telegramNotifier
|
||||
.Received(1)
|
||||
.NotifyAdminsBugReportCreatedAsync(
|
||||
Arg.Any<Guid>(),
|
||||
"alice",
|
||||
"Что-то сломалось",
|
||||
Arg.Any<CancellationToken>()
|
||||
);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -42,13 +57,23 @@ public class CreateBugReportTicketCommandHandlerTests
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var currentUser = FakeCurrentUser.Authenticated(Guid.NewGuid());
|
||||
var attachments = Enumerable.Range(0, 6)
|
||||
var attachments = Enumerable
|
||||
.Range(0, 6)
|
||||
.Select(_ => new TicketAttachmentUpload(new MemoryStream(), "a.png", "image/png", 10))
|
||||
.ToList();
|
||||
|
||||
var handler = new CreateBugReportTicketCommandHandler(dbContext, _fileStorage, _notifier, _telegramNotifier, currentUser);
|
||||
var handler = new CreateBugReportTicketCommandHandler(
|
||||
dbContext,
|
||||
_fileStorage,
|
||||
_notifier,
|
||||
_telegramNotifier,
|
||||
currentUser
|
||||
);
|
||||
|
||||
var result = await handler.Handle(new CreateBugReportTicketCommand("текст", attachments), CancellationToken.None);
|
||||
var result = await handler.Handle(
|
||||
new CreateBugReportTicketCommand("текст", attachments),
|
||||
CancellationToken.None
|
||||
);
|
||||
|
||||
Assert.False(result.IsSuccess);
|
||||
Assert.Equal(SupportErrors.TooManyAttachments, result.Error);
|
||||
@@ -59,11 +84,23 @@ public class CreateBugReportTicketCommandHandlerTests
|
||||
{
|
||||
using var dbContext = InMemoryDbContextFactory.Create();
|
||||
var currentUser = FakeCurrentUser.Authenticated(Guid.NewGuid());
|
||||
var attachments = new[] { new TicketAttachmentUpload(new MemoryStream(), "a.exe", "application/x-msdownload", 10) };
|
||||
var attachments = new[]
|
||||
{
|
||||
new TicketAttachmentUpload(new MemoryStream(), "a.exe", "application/x-msdownload", 10),
|
||||
};
|
||||
|
||||
var handler = new CreateBugReportTicketCommandHandler(dbContext, _fileStorage, _notifier, _telegramNotifier, currentUser);
|
||||
var handler = new CreateBugReportTicketCommandHandler(
|
||||
dbContext,
|
||||
_fileStorage,
|
||||
_notifier,
|
||||
_telegramNotifier,
|
||||
currentUser
|
||||
);
|
||||
|
||||
var result = await handler.Handle(new CreateBugReportTicketCommand("текст", attachments), CancellationToken.None);
|
||||
var result = await handler.Handle(
|
||||
new CreateBugReportTicketCommand("текст", attachments),
|
||||
CancellationToken.None
|
||||
);
|
||||
|
||||
Assert.False(result.IsSuccess);
|
||||
Assert.Equal(SupportErrors.UnsupportedAttachmentType, result.Error);
|
||||
|
||||
Reference in New Issue
Block a user