Adding Unit Test

This commit is contained in:
fa0xh1 2024-07-16 15:08:18 +07:00
parent 4fe28dd538
commit 11c11a1309
62 changed files with 65 additions and 55 deletions

View File

@ -7,22 +7,23 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FDCD7C52-B43
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{F54A3A88-80CB-4D9C-9ACD-A14A82876FAA}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{F54A3A88-80CB-4D9C-9ACD-A14A82876FAA}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSkeletonAPI.Application", "src\core\MiniSkeletonAPI.Application\MiniSkeletonAPI.Application.csproj", "{ACB30A63-8B21-45E6-89D9-BE794FA492D2}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniSkeletonAPI.Application", "src\core\MiniSkeletonAPI.Application\MiniSkeletonAPI.Application.csproj", "{ACB30A63-8B21-45E6-89D9-BE794FA492D2}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSkeletonAPI.Domain", "src\core\MiniSkeletonAPI.Domain\MiniSkeletonAPI.Domain.csproj", "{11E7C90E-B5C9-4F64-BA12-DB7DBB4D4FB8}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniSkeletonAPI.Domain", "src\core\MiniSkeletonAPI.Domain\MiniSkeletonAPI.Domain.csproj", "{11E7C90E-B5C9-4F64-BA12-DB7DBB4D4FB8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSkeletonAPI.Infrastructure", "src\MiniSkeletonAPI.Infrastructure\MiniSkeletonAPI.Infrastructure.csproj", "{A2AD3474-503B-436D-A521-CDB88E3C490A}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniSkeletonAPI.Infrastructure", "src\MiniSkeletonAPI.Infrastructure\MiniSkeletonAPI.Infrastructure.csproj", "{A2AD3474-503B-436D-A521-CDB88E3C490A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSkeletonAPI.Presentation", "src\MiniSkeletonAPI.Presentation\MiniSkeletonAPI.Presentation.csproj", "{E02CEC6A-A021-4B66-8F10-B154943A359A}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiniSkeletonAPI.Presentation", "src\MiniSkeletonAPI.Presentation\MiniSkeletonAPI.Presentation.csproj", "{E02CEC6A-A021-4B66-8F10-B154943A359A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{41006457-5811-45A5-9144-FAFF70512FE9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application.UnitTests", "tests\Application.UnitTests\Application.UnitTests.csproj", "{03E0E04F-2D53-4D0E-82EC-2B5F2E8788EE}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ACB30A63-8B21-45E6-89D9-BE794FA492D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ACB30A63-8B21-45E6-89D9-BE794FA492D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ACB30A63-8B21-45E6-89D9-BE794FA492D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {ACB30A63-8B21-45E6-89D9-BE794FA492D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
@ -40,6 +41,13 @@ Global
{E02CEC6A-A021-4B66-8F10-B154943A359A}.Debug|Any CPU.Build.0 = Debug|Any CPU {E02CEC6A-A021-4B66-8F10-B154943A359A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E02CEC6A-A021-4B66-8F10-B154943A359A}.Release|Any CPU.ActiveCfg = Release|Any CPU {E02CEC6A-A021-4B66-8F10-B154943A359A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E02CEC6A-A021-4B66-8F10-B154943A359A}.Release|Any CPU.Build.0 = Release|Any CPU {E02CEC6A-A021-4B66-8F10-B154943A359A}.Release|Any CPU.Build.0 = Release|Any CPU
{03E0E04F-2D53-4D0E-82EC-2B5F2E8788EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03E0E04F-2D53-4D0E-82EC-2B5F2E8788EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03E0E04F-2D53-4D0E-82EC-2B5F2E8788EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03E0E04F-2D53-4D0E-82EC-2B5F2E8788EE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{F54A3A88-80CB-4D9C-9ACD-A14A82876FAA} = {FDCD7C52-B43C-4CA4-9D30-7AB851951E39} {F54A3A88-80CB-4D9C-9ACD-A14A82876FAA} = {FDCD7C52-B43C-4CA4-9D30-7AB851951E39}
@ -47,5 +55,9 @@ Global
{11E7C90E-B5C9-4F64-BA12-DB7DBB4D4FB8} = {F54A3A88-80CB-4D9C-9ACD-A14A82876FAA} {11E7C90E-B5C9-4F64-BA12-DB7DBB4D4FB8} = {F54A3A88-80CB-4D9C-9ACD-A14A82876FAA}
{A2AD3474-503B-436D-A521-CDB88E3C490A} = {FDCD7C52-B43C-4CA4-9D30-7AB851951E39} {A2AD3474-503B-436D-A521-CDB88E3C490A} = {FDCD7C52-B43C-4CA4-9D30-7AB851951E39}
{E02CEC6A-A021-4B66-8F10-B154943A359A} = {FDCD7C52-B43C-4CA4-9D30-7AB851951E39} {E02CEC6A-A021-4B66-8F10-B154943A359A} = {FDCD7C52-B43C-4CA4-9D30-7AB851951E39}
{03E0E04F-2D53-4D0E-82EC-2B5F2E8788EE} = {41006457-5811-45A5-9144-FAFF70512FE9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E01C8518-F7D9-4E0A-8BD4-B4074354ACE5}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("MiniSkeletonAPI.Infrastructure")] [assembly: System.Reflection.AssemblyCompanyAttribute("MiniSkeletonAPI.Infrastructure")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+23690cc6cfd1a2e53e900ac2af495188aec711a8")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4fe28dd538e8171d2267768910b48d50b27058cc")]
[assembly: System.Reflection.AssemblyProductAttribute("MiniSkeletonAPI.Infrastructure")] [assembly: System.Reflection.AssemblyProductAttribute("MiniSkeletonAPI.Infrastructure")]
[assembly: System.Reflection.AssemblyTitleAttribute("MiniSkeletonAPI.Infrastructure")] [assembly: System.Reflection.AssemblyTitleAttribute("MiniSkeletonAPI.Infrastructure")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
9a141473a6c4e9e442c12a22fc8f244939166b7f21e146d0f8bac682dd56d497 76fa272b0b9759409e6037a1576f3395c1aa5327652255618b02eea0c19596b0

View File

@ -1 +1 @@
{"documents":{"D:\\DevPT3\\MiniSkeletonAPI\\*":"https://raw.githubusercontent.com/fa0xh1/MinimalAPIAsp/23690cc6cfd1a2e53e900ac2af495188aec711a8/*"}} {"documents":{"D:\\DevPT3\\MiniSkeletonAPI\\*":"https://raw.githubusercontent.com/fa0xh1/MinimalAPIAsp/4fe28dd538e8171d2267768910b48d50b27058cc/*"}}

View File

@ -4,7 +4,7 @@ using MiniSkeletonAPI.Application.TodoItems.Commands.CreateTodoItem;
using MiniSkeletonAPI.Application.TodoItems.Commands.DeleteTodoItem; using MiniSkeletonAPI.Application.TodoItems.Commands.DeleteTodoItem;
using MiniSkeletonAPI.Application.TodoItems.Commands.UpdateTodoItem; using MiniSkeletonAPI.Application.TodoItems.Commands.UpdateTodoItem;
using MiniSkeletonAPI.Application.TodoItems.Commands.UpdateTodoItemDetail; using MiniSkeletonAPI.Application.TodoItems.Commands.UpdateTodoItemDetail;
using MiniSkeletonAPI.Application.TodoItems.Queries.GetTodoItemsWIthPagination; using MiniSkeletonAPI.Application.TodoItems.Queries.GetTodoItemsWithPagination;
using MiniSkeletonAPI.Infrastructure.Identity.Permission; using MiniSkeletonAPI.Infrastructure.Identity.Permission;
using System.Text.Json; using System.Text.Json;

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("MiniSkeletonAPI.Presentation")] [assembly: System.Reflection.AssemblyCompanyAttribute("MiniSkeletonAPI.Presentation")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+23690cc6cfd1a2e53e900ac2af495188aec711a8")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4fe28dd538e8171d2267768910b48d50b27058cc")]
[assembly: System.Reflection.AssemblyProductAttribute("MiniSkeletonAPI.Presentation")] [assembly: System.Reflection.AssemblyProductAttribute("MiniSkeletonAPI.Presentation")]
[assembly: System.Reflection.AssemblyTitleAttribute("MiniSkeletonAPI.Presentation")] [assembly: System.Reflection.AssemblyTitleAttribute("MiniSkeletonAPI.Presentation")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
f11af4d06d5d5309d02728ceefe793f1eeac69aa03222dea09e3c730091b755d d0e45940c0363d058861e8f9a2bbe5bc80bb85c3d42f570c749d4fe6efd22669

View File

@ -1 +1 @@
{"documents":{"D:\\DevPT3\\MiniSkeletonAPI\\*":"https://raw.githubusercontent.com/fa0xh1/MinimalAPIAsp/23690cc6cfd1a2e53e900ac2af495188aec711a8/*"}} {"documents":{"D:\\DevPT3\\MiniSkeletonAPI\\*":"https://raw.githubusercontent.com/fa0xh1/MinimalAPIAsp/4fe28dd538e8171d2267768910b48d50b27058cc/*"}}

View File

@ -1,34 +1,34 @@
//using CleanArchitecture.Application.Common.Interfaces; using MiniSkeletonAPI.Application.Common.Interfaces;
//using MediatR.Pipeline; using MediatR.Pipeline;
//using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
//namespace MiniSkeletonAPI.Application.Common.Behaviours; namespace MiniSkeletonAPI.Application.Common.Behaviours;
//public class LoggingBehaviour<TRequest> : IRequestPreProcessor<TRequest> where TRequest : notnull public class LoggingBehaviour<TRequest> : IRequestPreProcessor<TRequest> where TRequest : notnull
//{ {
// private readonly ILogger _logger; private readonly ILogger _logger;
// private readonly IUser _user; private readonly IUser _user;
// private readonly IIdentityService _identityService; private readonly IIdentityService _identityService;
// public LoggingBehaviour(ILogger<TRequest> logger, IUser user, IIdentityService identityService) public LoggingBehaviour(ILogger<TRequest> logger, IUser user, IIdentityService identityService)
// { {
// _logger = logger; _logger = logger;
// _user = user; _user = user;
// _identityService = identityService; _identityService = identityService;
// } }
// public async Task Process(TRequest request, CancellationToken cancellationToken) public async Task Process(TRequest request, CancellationToken cancellationToken)
// { {
// var requestName = typeof(TRequest).Name; var requestName = typeof(TRequest).Name;
// var userId = _user.Id ?? string.Empty; var userId = _user.Id ?? string.Empty;
// string? userName = string.Empty; string? userName = string.Empty;
// if (!string.IsNullOrEmpty(userId)) if (!string.IsNullOrEmpty(userId))
// { {
// userName = await _identityService.GetUserNameAsync(userId); userName = await _identityService.GetUserNameAsync(userId);
// } }
// _logger.LogInformation("CleanArchitecture Request: {Name} {@UserId} {@UserName} {@Request}", _logger.LogInformation("MiniSkeleton Request: {Name} {@UserId} {@UserName} {@Request}",
// requestName, userId, userName, request); requestName, userId, userName, request);
// } }
//} }

View File

@ -4,7 +4,7 @@ namespace MiniSkeletonAPI.Application.Common.Models;
public class LookupDto public class LookupDto
{ {
public int Id { get; init; } public Guid Id { get; init; }
public string? Title { get; init; } public string? Title { get; init; }

View File

@ -3,7 +3,7 @@ using MiniSkeletonAPI.Application.Common.Interfaces;
using MiniSkeletonAPI.Application.Common.Mappings; using MiniSkeletonAPI.Application.Common.Mappings;
using MiniSkeletonAPI.Application.Common.Models; using MiniSkeletonAPI.Application.Common.Models;
namespace MiniSkeletonAPI.Application.TodoItems.Queries.GetTodoItemsWIthPagination; namespace MiniSkeletonAPI.Application.TodoItems.Queries.GetTodoItemsWithPagination;
public record GetTodoItemsWithPaginationQuery : IRequest<PaginatedList<TodoItemBriefDto>> public record GetTodoItemsWithPaginationQuery : IRequest<PaginatedList<TodoItemBriefDto>>
{ {

View File

@ -1,4 +1,4 @@
namespace MiniSkeletonAPI.Application.TodoItems.Queries.GetTodoItemsWIthPagination; namespace MiniSkeletonAPI.Application.TodoItems.Queries.GetTodoItemsWithPagination;
public class GetTodoItemsWithPaginationQueryValidator : AbstractValidator<GetTodoItemsWithPaginationQuery> public class GetTodoItemsWithPaginationQueryValidator : AbstractValidator<GetTodoItemsWithPaginationQuery>
{ {

View File

@ -1,6 +1,6 @@
using MiniSkeletonAPI.Domain.Entities; using MiniSkeletonAPI.Domain.Entities;
namespace MiniSkeletonAPI.Application.TodoItems.Queries.GetTodoItemsWIthPagination; namespace MiniSkeletonAPI.Application.TodoItems.Queries.GetTodoItemsWithPagination;
public class TodoItemBriefDto public class TodoItemBriefDto
{ {

View File

@ -24,7 +24,7 @@ public class GetTodosQueryHandler : IRequestHandler<GetTodosQuery, TodosVm>
{ {
PriorityLevels = Enum.GetValues(typeof(PriorityLevel)) PriorityLevels = Enum.GetValues(typeof(PriorityLevel))
.Cast<PriorityLevel>() .Cast<PriorityLevel>()
.Select(p => new LookupDto { Id = (int)p, Title = p.ToString() }) .Select(p => new LookupDto { Id = Guid.Parse(p.ToString()), Title = p.ToString() })
.ToList(), .ToList(),
Lists = await _context.TodoLists Lists = await _context.TodoLists

View File

@ -13,8 +13,6 @@ public class TodoListDto
public string? Title { get; init; } public string? Title { get; init; }
public string? Colour { get; init; }
public IReadOnlyCollection<TodoItemDto> Items { get; init; } public IReadOnlyCollection<TodoItemDto> Items { get; init; }
private class Mapping : Profile private class Mapping : Profile

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("MiniSkeletonAPI.Application")] [assembly: System.Reflection.AssemblyCompanyAttribute("MiniSkeletonAPI.Application")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+23690cc6cfd1a2e53e900ac2af495188aec711a8")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4fe28dd538e8171d2267768910b48d50b27058cc")]
[assembly: System.Reflection.AssemblyProductAttribute("MiniSkeletonAPI.Application")] [assembly: System.Reflection.AssemblyProductAttribute("MiniSkeletonAPI.Application")]
[assembly: System.Reflection.AssemblyTitleAttribute("MiniSkeletonAPI.Application")] [assembly: System.Reflection.AssemblyTitleAttribute("MiniSkeletonAPI.Application")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
53ba1e480d5d8dbf354c004c983300e958e0198cacba93222777114b65ee07f3 fee578d4b2bc5394e11bd4098c11f113637d82e2558a62936136520fd3139202

View File

@ -1 +1 @@
{"documents":{"D:\\DevPT3\\MiniSkeletonAPI\\*":"https://raw.githubusercontent.com/fa0xh1/MinimalAPIAsp/23690cc6cfd1a2e53e900ac2af495188aec711a8/*"}} {"documents":{"D:\\DevPT3\\MiniSkeletonAPI\\*":"https://raw.githubusercontent.com/fa0xh1/MinimalAPIAsp/4fe28dd538e8171d2267768910b48d50b27058cc/*"}}

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("MiniSkeletonAPI.Domain")] [assembly: System.Reflection.AssemblyCompanyAttribute("MiniSkeletonAPI.Domain")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+23690cc6cfd1a2e53e900ac2af495188aec711a8")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4fe28dd538e8171d2267768910b48d50b27058cc")]
[assembly: System.Reflection.AssemblyProductAttribute("MiniSkeletonAPI.Domain")] [assembly: System.Reflection.AssemblyProductAttribute("MiniSkeletonAPI.Domain")]
[assembly: System.Reflection.AssemblyTitleAttribute("MiniSkeletonAPI.Domain")] [assembly: System.Reflection.AssemblyTitleAttribute("MiniSkeletonAPI.Domain")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
4418b0950f3ef09ec3f06b452024f2dd7e5a0c75243d055cff5e26f1b57e92bd 0ec0d8997e090059f6fd73b36aba7a31adf6ab5dbd0a2b513d4a7f8111bc50b2

View File

@ -1 +1 @@
{"documents":{"D:\\DevPT3\\MiniSkeletonAPI\\*":"https://raw.githubusercontent.com/fa0xh1/MinimalAPIAsp/23690cc6cfd1a2e53e900ac2af495188aec711a8/*"}} {"documents":{"D:\\DevPT3\\MiniSkeletonAPI\\*":"https://raw.githubusercontent.com/fa0xh1/MinimalAPIAsp/4fe28dd538e8171d2267768910b48d50b27058cc/*"}}