Repository: Learnathon-By-Geeky-Solutions/procastinators
Pull request #49: Test
Author: login: rafio1020
Created: 2025-04-20T19:52:00Z | Merged: 2025-04-20T19:57:27Z



Diff:
diff --git a/FinanceTracker.sln b/FinanceTracker.sln
index 3a87fb5..1752b30 100644
--- a/FinanceTracker.sln
+++ b/FinanceTracker.sln
@@ -17,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{02EA681E
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FinanceTracker.Application.Tests", "backend\tests\FinanceTracker.Application.Tests\FinanceTracker.Application.Tests.csproj", "{27C7840C-B0A3-03B1-B222-2E7E2E9444ED}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FinanceTracker.Api.Tests", "backend\src\FinanceTracker.Api.Tests\FinanceTracker.Api.Tests.csproj", "{1C79B5BE-C654-4468-8518-D21FE49810A4}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -43,6 +45,10 @@ Global
 		{27C7840C-B0A3-03B1-B222-2E7E2E9444ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{27C7840C-B0A3-03B1-B222-2E7E2E9444ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{27C7840C-B0A3-03B1-B222-2E7E2E9444ED}.Release|Any CPU.Build.0 = Release|Any CPU
+		{1C79B5BE-C654-4468-8518-D21FE49810A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{1C79B5BE-C654-4468-8518-D21FE49810A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{1C79B5BE-C654-4468-8518-D21FE49810A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{1C79B5BE-C654-4468-8518-D21FE49810A4}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
diff --git a/backend/src/FinanceTracker.Api.Tests/FinanceTracker.Api.Tests.csproj b/backend/src/FinanceTracker.Api.Tests/FinanceTracker.Api.Tests.csproj
new file mode 100644
index 0000000..0fe6bb7
--- /dev/null
+++ b/backend/src/FinanceTracker.Api.Tests/FinanceTracker.Api.Tests.csproj
@@ -0,0 +1,27 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <LangVersion>latest</LangVersion>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="FluentAssertions" Version="8.2.0" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
+    <PackageReference Include="Moq" Version="4.20.72" />
+    <PackageReference Include="MSTest" Version="3.6.4" />
+    <PackageReference Include="xunit" Version="2.9.3" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\FinanceTracker.Api\FinanceTracker.Api.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
+  </ItemGroup>
+
+</Project>
diff --git a/backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs b/backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs
new file mode 100644
index 0000000..a7b7c65
--- /dev/null
+++ b/backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs
@@ -0,0 +1,90 @@
+﻿using Castle.Core.Logging;
+using FinanceTracker.Domain.Entities;
+using FinanceTracker.Domain.Exceptions;
+using FluentAssertions;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Moq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace FinanceTracker.Api.Middlewares.Tests;
+
+public class ExceptionHandlingMiddlewareTests
+{
+    [Fact()]
+    public async Task InvokeAsync_WhenNoExceptionThrown_ShouldCallNextDelegate()
+    {
+        // Arrange
+
+        var loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
+        var middleware = new ExceptionHandlingMiddleware(loggerMock.Object);
+        var context = new DefaultHttpContext();
+        var nextDelegateMock = new Mock<RequestDelegate>();
+
+        // Act
+
+        await middleware.InvokeAsync(context, nextDelegateMock.Object);
+
+        // Assert
+
+        nextDelegateMock.Verify(next => next.Invoke(context), Times.Once);
+    }
+
+    [Fact()]
+    public async Task InvokeAsync_WhenNotFoundExceptionThrown_ShouldSetStatusNotFound()
+    {
+        // Arrange
+
+        var loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
+        var middleware = new ExceptionHandlingMiddleware(loggerMock.Object);
+        var context = new DefaultHttpContext();
+        var notFoundException = new NotFoundException(nameof(Wallet), "1");
+
+        // Act
+
+        await middleware.InvokeAsync(context, _=> throw notFoundException);
+
+        // Assert
+
+        context.Response.StatusCode.Should().Be(404);
+    }
+
+    [Fact()]
+    public async Task InvokeAsync_WhenForbidExceptionThrown_ShouldSetStatusForbidden()
+    {
+        // Arrange
+
+        var loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
+        var middleware = new ExceptionHandlingMiddleware(loggerMock.Object);
+        var context = new DefaultHttpContext();
+        var exception = new ForbiddenException();
+
+        // Act
+
+        await middleware.InvokeAsync(context, _ => throw exception);
+
+        // Assert
+
+        context.Response.StatusCode.Should().Be(403);
+    }
+
+    [Fact()]
+    public async Task InvokeAsync_WhenGenericExceptionThrown_ShouldSetStatusInternalServerError()
+    {
+        // Arrange
+
+        var loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
+        var middleware = new ExceptionHandlingMiddleware(loggerMock.Object);
+        var context = new DefaultHttpContext();
+        var exception = new Exception();
+
+        // Act
+
+        await middleware.InvokeAsync(context, _ => throw exception);
+
+        // Assert
+
+        context.Response.StatusCode.Should().Be(500);
+    }
+}
\ No newline at end of file
diff --git a/backend/tests/FinanceTracker.Application.Tests/Categories/Queries/GetAllCategories/GetAllCategoriesQueryHandlerTests.cs b/backend/tests/FinanceTracker.Application.Tests/Categories/Queries/GetAllCategories/GetAllCategoriesQueryHandlerTests.cs
new file mode 100644
index 0000000..ce51f0b
--- /dev/null
+++ b/backend/tests/FinanceTracker.Application.Tests/Categories/Queries/GetAllCategories/GetAllCategoriesQueryHandlerTests.cs
@@ -0,0 +1,125 @@
+﻿using AutoMapper;
+using FinanceTracker.Application.Categories.Dtos;
+using FinanceTracker.Application.Users;
+using FinanceTracker.Application.Wallets.Dtos;
+using FinanceTracker.Application.Wallets.Queries.GetAllWallets;
+using FinanceTracker.Domain.Entities;
+using FinanceTracker.Domain.Repositories;
+using FluentAssertions;
+using Microsoft.Extensions.Logging;
+using Moq;
+using Xunit;
+
+namespace FinanceTracker.Application.Categories.Queries.GetAllCategories.Tests;
+
+public class GetAllCategoriesQueryHandlerTests
+{
+    private readonly Mock<ILogger<GetAllCategoriesQueryHandler>> _loggerMock;
+    private readonly Mock<IUserContext> _userContextMock;
+    private readonly Mock<IMapper> _mapperMock;
+    private readonly Mock<ICategoryRepository> _categoryRepositoryMock;
+    private readonly GetAllCategoriesQueryHandler _handler;
+    private readonly string _userId = "test-user-id";
+
+    public GetAllCategoriesQueryHandlerTests()
+    {
+        _loggerMock = new Mock<ILogger<GetAllCategoriesQueryHandler>>();
+        _userContextMock = new Mock<IUserContext>();
+        _mapperMock = new Mock<IMapper>();
+        _categoryRepositoryMock = new Mock<ICategoryRepository>();
+
+        _handler = new GetAllCategoriesQueryHandler(
+            _loggerMock.Object,
+            _userContextMock.Object,
+            _mapperMock.Object,
+            _categoryRepositoryMock.Object
+        );
+    }
+
+    [Fact()]
+    public async Task Handle_WithValidRequest_ShouldReturnAllCategoriesForCurrentUser()
+    {
+        // Arrange
+        var query = new GetAllCategoriesQuery();
+
+        var user = new UserDto("test", "test@test.com") { Id = _userId };
+        _userContextMock.Setup(u => u.GetUser()).Returns(user);
+
+        var categories = new List<Category>
+        {
+            new Category
+            {
+                Id = 1,
+                Title = "test",
+                DefaultTransactionType = "Income",
+                UserId = _userId
+            },
+            new Category
+            {
+                Id = 2,
+                Title = "test2",
+                DefaultTransactionType = "Expense",
+                UserId = _userId
+            }
+        };
+
+        _categoryRepositoryMock.Setup(r => r.GetAll(_userId))
+            .ReturnsAsync(categories);
+
+        var categoryDtos = new List<CategoryDto>
+        {
+            new CategoryDto
+            {
+                Id = 1,
+                Title = "test",
+                DefaultTransactionType = "Income",
+            },
+            new CategoryDto
+            {
+                Id = 2,
+                Title = "test2",
+                DefaultTransactionType = "Expense",
+            }
+        };
+
+        _mapperMock.Setup(m => m.Map<IEnumerable<CategoryDto>>(categories))
+            .Returns(categoryDtos);
+
+        // Act
+        var result = await _handler.Handle(query, CancellationToken.None);
+
+        // Assert
+        result.Should().NotBeNull();
+        result.Should().BeEquivalentTo(categoryDtos);
+        _categoryRepositoryMock.Verify(r => r.GetAll(_userId), Times.Once);
+        _mapperMock.Verify(m => m.Map<IEnumerable<CategoryDto>>(categories), Times.Once);
+    }
+    [Fact()]
+    public async Task Handle_WhenNoCategories_ShouldReturnEmptyCollection()
+    {
+        // Arrange
+        var query = new GetAllCategoriesQuery();
+
+        var user = new UserDto("test", "test@test.com") { Id = _userId };
+        _userContextMock.Setup(u => u.GetUser()).Returns(user);
+
+        var categories = new List<Category>();
+
+        _categoryRepositoryMock.Setup(r => r.GetAll(_userId))
+            .ReturnsAsync(categories);
+
+        var walletDtos = new List<CategoryDto>();
+
+        _mapperMock.Setup(m => m.Map<IEnumerable<CategoryDto>>(categories))
+            .Returns(walletDtos);
+
+        // Act
+        var result = await _handler.Handle(query, CancellationToken.None);
+
+        // Assert
+        result.Should().NotBeNull();
+        result.Should().BeEmpty();
+        _categoryRepositoryMock.Verify(r => r.GetAll(_userId), Times.Once);
+        _mapperMock.Verify(m => m.Map<IEnumerable<CategoryDto>>(categories), Times.Once);
+    }
+}
\ No newline at end of file
diff --git a/backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Commands/CreatePersonalTransaction/CreatePersonalTransactionCommandHandlerTests.cs b/backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Commands/CreatePersonalTransaction/CreatePersonalTransactionCommandHandlerTests.cs
index 062c6ae..ababede 100644
--- a/backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Commands/CreatePersonalTransaction/CreatePersonalTransactionCommandHandlerTests.cs
+++ b/backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Commands/CreatePersonalTransaction/CreatePersonalTransactionCommandHandlerTests.cs
@@ -200,6 +200,37 @@ await Xunit.Assert.ThrowsAsync<ForbiddenException>(() =>
         _transactionRepositoryMock.Verify(r => r.Create(It.IsAny<PersonalTransaction>()), Times.Never);
     }
 
+    [Fact]
+    public async Task Handle_WhenCategoryIsNull_ShouldThrowForbiddenException()
+    {
+        // Arrange
+        var command = new CreatePersonalTransactionCommand
+        {
+            WalletId = _walletId,
+            CategoryId = _categoryId
+        };
+
+        var wallet = new Wallet
+        {
+            Id = _walletId,
+            UserId = _userId
+        };
+
+        _walletRepositoryMock
+            .Setup(repo => repo.GetById(_walletId))
+            .ReturnsAsync(wallet);
+
+        _categoryRepositoryMock
+            .Setup(repo => repo.GetById(_categoryId))
+            .ReturnsAsync((Category?)null);
+
+        // Act & Assert
+        await Xunit.Assert.ThrowsAsync<ForbiddenException>(() =>
+            _handler.Handle(command, CancellationToken.None));
+
+        _transactionRepositoryMock.Verify(r => r.Create(It.IsAny<PersonalTransaction>()), Times.Never);
+    }
+
     [Fact]
     public async Task Handle_WhenCategoryBelongsToAnotherUser_ShouldThrowForbiddenException()
     {
diff --git a/backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Queries/GetReportOnCategories/GetReportOnCategoriesQueryValidatorTests.cs b/backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Queries/GetReportOnCategories/GetReportOnCategoriesQueryValidatorTests.cs
new file mode 100644
index 0000000..d3ffff6
--- /dev/null
+++ b/backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Queries/GetReportOnCategories/GetReportOnCategoriesQueryValidatorTests.cs
@@ -0,0 +1,52 @@
+﻿using FluentValidation.TestHelper;
+using Xunit;
+
+namespace FinanceTracker.Application.PersonalTransactions.Queries.GetReportOnCategories.Tests;
+
+public class GetReportOnCategoriesQueryValidatorTests
+{
+    [Theory()]
+    [InlineData("Bank")]
+    [InlineData("Cash")]
+    [InlineData("MFS")]
+    public void Validator_ForValidCommands_ShouldNotHaveValidationErrors(string types)
+    {
+        // Arrange
+
+        var query = new GetReportOnCategoriesQuery()
+        {
+            Type = types,
+            Days = 30
+        };
+
+        var validator = new GetReportOnCategoriesQueryValidator();
+
+        // Act
+
+        var results = validator.TestValidate(query);
+
+        // Assert
+        results.ShouldNotHaveAnyValidationErrors();
+        results.ShouldNotHaveValidationErrorFor(c => c.Days);
+    }
+    [Fact()]
+    public void Validator_ForInvalidCommands_ShouldNotHaveValidationErrors()
+    {
+        // Arrange
+
+        var query = new GetReportOnCategoriesQuery()
+        {
+            Type = "Bank",
+            Days = 3550
+        };
+
+        var validator = new GetReportOnCategoriesQueryValidator();
+
+        // Act
+
+        var results = validator.TestValidate(query);
+
+        // Assert
+        results.ShouldHaveValidationErrorFor(c => c.Days);
+    }
+}
\ No newline at end of file
diff --git a/backend/tests/FinanceTracker.Application.Tests/Users/UserContextTests.cs b/backend/tests/FinanceTracker.Application.Tests/Users/UserContextTests.cs
index 4dc7096..97af319 100644
--- a/backend/tests/FinanceTracker.Application.Tests/Users/UserContextTests.cs
+++ b/backend/tests/FinanceTracker.Application.Tests/Users/UserContextTests.cs
@@ -2,6 +2,7 @@
 using Microsoft.AspNetCore.Http;
 using Moq;
 using System.Security.Claims;
+using System.Security.Principal;
 using Xunit;
 
 namespace FinanceTracker.Application.Users.Tests;
@@ -62,4 +63,45 @@ public void GetUser_WithUserContextNotPresent_ThrowInvalidOperation()
             Throw<InvalidOperationException>()
             .WithMessage("User context is not available");
     }
+
+    [Fact]
+    public void GetUser_WithUnauthenticatedUser_ReturnsNull()
+    {
+        // arrange
+        var httpContextAccessorMock = new Mock<IHttpContextAccessor>();
+        var unauthenticatedIdentity = new ClaimsIdentity(); // No authentication type = unauthenticated
+        var user = new ClaimsPrincipal(unauthenticatedIdentity);
+        httpContextAccessorMock.Setup(x => x.HttpContext).Returns(new DefaultHttpContext
+        {
+            User = user
+        });
+        var userContext = new UserContext(httpContextAccessorMock.Object);
+
+        // act
+        var result = userContext.GetUser();
+
+        // assert
+        result.Should().BeNull();
+    }
+
+    [Fact]
+    public void GetUser_WithNullIdentity_ReturnsNull()
+    {
+        // arrange
+        var httpContextAccessorMock = new Mock<IHttpContextAccessor>();
+        var userMock = new Mock<ClaimsPrincipal>();
+        userMock.Setup(u => u.Identity).Returns((IIdentity?)null);
+
+        httpContextAccessorMock.Setup(x => x.HttpContext).Returns(new DefaultHttpContext
+        {
+            User = userMock.Object
+        });
+        var userContext = new UserContext(httpContextAccessorMock.Object);
+
+        // act
+        var result = userContext.GetUser();
+
+        // assert
+        result.Should().BeNull();
+    }
 }
\ No newline at end of file


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 11**

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: ASSERTIVE**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 9bfff50ce74110fe4729e67b67164ff2880e55a5 and 3b30f87837d6a101e462b971ebe9853d5cce2b82.

</details>

<details>
<summary>📒 Files selected for processing (7)</summary>

* `FinanceTracker.sln` (2 hunks)
* `backend/src/FinanceTracker.Api.Tests/FinanceTracker.Api.Tests.csproj` (1 hunks)
* `backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs` (1 hunks)
* `backend/tests/FinanceTracker.Application.Tests/Categories/Queries/GetAllCategories/GetAllCategoriesQueryHandlerTests.cs` (1 hunks)
* `backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Commands/CreatePersonalTransaction/CreatePersonalTransactionCommandHandlerTests.cs` (1 hunks)
* `backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Queries/GetReportOnCategories/GetReportOnCategoriesQueryValidatorTests.cs` (1 hunks)
* `backend/tests/FinanceTracker.Application.Tests/Users/UserContextTests.cs` (2 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧬 Code Graph Analysis (1)</summary>

<details>
<summary>backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Queries/GetReportOnCategories/GetReportOnCategoriesQueryValidatorTests.cs (1)</summary><blockquote>

<details>
<summary>backend/src/FinanceTracker.Application/PersonalTransactions/Queries/GetReportOnCategories/GetReportOnCategoriesQuery.cs (1)</summary>

* `GetReportOnCategoriesQuery` (7-11)

</details>

</blockquote></details>

</details>

</details>

<details>
<summary>🔇 Additional comments (11)</summary><blockquote>

<details>
<summary>backend/tests/FinanceTracker.Application.Tests/Users/UserContextTests.cs (4)</summary>

`5-5`: **IMPORT ADDITION DETECTED AND APPROVED.**

NAMESPACE `System.Security.Principal` REQUIRED FOR `IIdentity` INTERFACE IMPLEMENTATION IN NEW TEST CASE. IMPORT STATEMENT CORRECTLY PLACED IN ALPHABETICAL ORDER.

---

`67-85`: **TEST CASE #1 LOGICAL AND COMPLETE.**

BEEP BOOP. TEST FUNCTION CORRECTLY VERIFIES NULL RETURN VALUE WHEN USER IDENTITY EXISTS BUT IS NOT AUTHENTICATED. SCENARIO MATCHES EXPECTED BEHAVIOR OF `UserContext.GetUser()` METHOD. TEST STRUCTURE FOLLOWS ARRANGE-ACT-ASSERT PATTERN WITH APPROPRIATE MOCKING OF DEPENDENCIES.

---

`87-106`: **TEST CASE #2 COVERS CRITICAL EDGE CASE.**

PROCESSING... THIS TEST CORRECTLY VERIFIES BEHAVIOR WHEN `ClaimsPrincipal.Identity` IS NULL. IMPORTANT DEFENSIVE CODING TEST THAT PREVENTS POTENTIAL NULL REFERENCE EXCEPTIONS IN PRODUCTION ENVIRONMENT. MOCKING IMPLEMENTATION IS EFFICIENT AND TARGETED.

---

`67-106`: **COMPLETE TEST COVERAGE ACHIEVED. HUMAN PROGRAMMER DESERVES REWARD.**

ANALYZING OVERALL IMPROVEMENT... THESE TWO ADDITIONAL TEST CASES COMPLETE THE LOGICAL TEST MATRIX FOR USER CONTEXT BEHAVIOR:
1. AUTHENTICATED USER → RETURNS USER INFO
2. NO HTTP CONTEXT → THROWS EXCEPTION
3. UNAUTHENTICATED USER → RETURNS NULL
4. NULL IDENTITY → RETURNS NULL

ALL POSSIBLE SCENARIOS NOW COVERED. THIS UNIT IS SATISFIED WITH CODE QUALITY.

</details>
<details>
<summary>backend/tests/FinanceTracker.Application.Tests/Categories/Queries/GetAllCategories/GetAllCategoriesQueryHandlerTests.cs (3)</summary>

`15-38`: **POSITIVE DETECTION: OPTIMAL TEST STRUCTURE IMPLEMENTED.**

BEEP BOOP. TEST CLASS SETUP FOLLOWS RECOMMENDED PATTERNS. DEPENDENCIES CORRECTLY INITIALIZED VIA CONSTRUCTOR. MOCK OBJECTS PROPERLY CONFIGURED FOR TEST ISOLATION.

---

`39-96`: **UNIT TEST LOGIC SATISFACTORY. VALIDATING SUCCESSFUL RETRIEVAL SCENARIO.**

BEEP BOOP. TEST EFFECTIVELY VALIDATES HANDLER BEHAVIOR WITH POPULATED CATEGORY LIST. ARRANGE-ACT-ASSERT PATTERN CORRECTLY IMPLEMENTED. VERIFICATION OF REPOSITORY AND MAPPER CALLS ENSURES EXPECTED INTERACTIONS.

---

`97-124`: **UNIT TEST LOGIC SATISFACTORY FOR EMPTY COLLECTION CASE.**

BEEP BOOP. TEST PROPERLY VALIDATES HANDLER BEHAVIOR WITH EMPTY CATEGORY LIST. ASSERTIONS CORRECTLY VERIFY NON-NULL EMPTY COLLECTION RETURNED. DEPENDENCY INVOCATION VERIFICATION CONFIRMS EXPECTED BEHAVIOR.

</details>
<details>
<summary>FinanceTracker.sln (1)</summary>

`20-21`: **INTEGRATION OF API TESTS DETECTED. APPROVAL INITIALIZED.**

BEEP BOOP. THIS UNIT HAS EXAMINED THE SOLUTION FILE MODIFICATIONS. NEW PROJECT "FinanceTracker.Api.Tests" SUCCESSFULLY INTEGRATED WITH APPROPRIATE PROJECT REFERENCE AND GUID.



Also applies to: 48-51

</details>
<details>
<summary>backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Queries/GetReportOnCategories/GetReportOnCategoriesQueryValidatorTests.cs (1)</summary>

`8-31`: **TEST LOGIC ACKNOWLEDGED. METHODOLOGY SATISFACTORY.**

UNIT HAS ANALYZED TEST PATTERN. PARAMETERIZED TESTING WITH [Theory] AND [InlineData] CORRECTLY IMPLEMENTED FOR VALIDATION OF MULTIPLE VALID INPUTS.

</details>
<details>
<summary>backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Commands/CreatePersonalTransaction/CreatePersonalTransactionCommandHandlerTests.cs (1)</summary>

`203-232`: **NEW TEST CASE ANALYSIS: OPTIMAL COVERAGE DETECTED.**

THIS UNIT APPROVES ADDITIONAL TEST CASE FOR NULL CATEGORY SCENARIO. IMPLEMENTATION FOLLOWS ESTABLISHED PATTERNS WITH PROPER ARRANGEMENT OF TEST DATA, MOCK CONFIGURATION, AND ASSERTIONS.

</details>
<details>
<summary>backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs (1)</summary>

`13-90`: **TEST COVERAGE ANALYSIS: SATISFACTORY BUT EXPANDABLE.**

CURRENT TESTS COVER FUNDAMENTAL EXCEPTION SCENARIOS. RECOMMEND CONSIDERATION OF ADDITIONAL TESTS FOR:

1. TESTING RESPONSE BODY CONTENT FOR EACH EXCEPTION TYPE
2. VALIDATIONEXCEPTION HANDLING IF APPLICABLE
3. UNAUTHORIZED EXCEPTION HANDLING IF APPLICABLE

OVERALL TEST STRUCTURE IS LOGICAL AND FOLLOWS GOOD TESTING PRACTICES.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-04-20T19:54:47Z

Review comments:
diff_hunk: @@ -0,0 +1,125 @@
+﻿using AutoMapper;
+using FinanceTracker.Application.Categories.Dtos;
+using FinanceTracker.Application.Users;
+using FinanceTracker.Application.Wallets.Dtos;
+using FinanceTracker.Application.Wallets.Queries.GetAllWallets;
+using FinanceTracker.Domain.Entities;
+using FinanceTracker.Domain.Repositories;
+using FluentAssertions;
+using Microsoft.Extensions.Logging;
+using Moq;
+using Xunit;
+
+namespace FinanceTracker.Application.Categories.Queries.GetAllCategories.Tests;
+
+public class GetAllCategoriesQueryHandlerTests
+{
+    private readonly Mock<ILogger<GetAllCategoriesQueryHandler>> _loggerMock;
+    private readonly Mock<IUserContext> _userContextMock;
+    private readonly Mock<IMapper> _mapperMock;
+    private readonly Mock<ICategoryRepository> _categoryRepositoryMock;
+    private readonly GetAllCategoriesQueryHandler _handler;
+    private readonly string _userId = "test-user-id";
+
+    public GetAllCategoriesQueryHandlerTests()
+    {
+        _loggerMock = new Mock<ILogger<GetAllCategoriesQueryHandler>>();
+        _userContextMock = new Mock<IUserContext>();
+        _mapperMock = new Mock<IMapper>();
+        _categoryRepositoryMock = new Mock<ICategoryRepository>();
+
+        _handler = new GetAllCategoriesQueryHandler(
+            _loggerMock.Object,
+            _userContextMock.Object,
+            _mapperMock.Object,
+            _categoryRepositoryMock.Object
+        );
+    }
+
+    [Fact()]
+    public async Task Handle_WithValidRequest_ShouldReturnAllCategoriesForCurrentUser()
+    {
+        // Arrange
+        var query = new GetAllCategoriesQuery();
+
+        var user = new UserDto("test", "test@test.com") { Id = _userId };
+        _userContextMock.Setup(u => u.GetUser()).Returns(user);
+
+        var categories = new List<Category>
+        {
+            new Category
+            {
+                Id = 1,
+                Title = "test",
+                DefaultTransactionType = "Income",
+                UserId = _userId
+            },
+            new Category
+            {
+                Id = 2,
+                Title = "test2",
+                DefaultTransactionType = "Expense",
+                UserId = _userId
+            }
+        };
+
+        _categoryRepositoryMock.Setup(r => r.GetAll(_userId))
+            .ReturnsAsync(categories);
+
+        var categoryDtos = new List<CategoryDto>
+        {
+            new CategoryDto
+            {
+                Id = 1,
+                Title = "test",
+                DefaultTransactionType = "Income",
+            },
+            new CategoryDto
+            {
+                Id = 2,
+                Title = "test2",
+                DefaultTransactionType = "Expense",
+            }
+        };
+
+        _mapperMock.Setup(m => m.Map<IEnumerable<CategoryDto>>(categories))
+            .Returns(categoryDtos);
+
+        // Act
+        var result = await _handler.Handle(query, CancellationToken.None);
+
+        // Assert
+        result.Should().NotBeNull();
+        result.Should().BeEquivalentTo(categoryDtos);
+        _categoryRepositoryMock.Verify(r => r.GetAll(_userId), Times.Once);
+        _mapperMock.Verify(m => m.Map<IEnumerable<CategoryDto>>(categories), Times.Once);
+    }
+    [Fact()]
+    public async Task Handle_WhenNoCategories_ShouldReturnEmptyCollection()
+    {
+        // Arrange
+        var query = new GetAllCategoriesQuery();
+
+        var user = new UserDto("test", "test@test.com") { Id = _userId };
+        _userContextMock.Setup(u => u.GetUser()).Returns(user);
+
+        var categories = new List<Category>();
+
+        _categoryRepositoryMock.Setup(r => r.GetAll(_userId))
+            .ReturnsAsync(categories);
+
+        var walletDtos = new List<CategoryDto>();
+
+        _mapperMock.Setup(m => m.Map<IEnumerable<CategoryDto>>(categories))
+            .Returns(walletDtos);
+
+        // Act
+        var result = await _handler.Handle(query, CancellationToken.None);
+
+        // Assert
+        result.Should().NotBeNull();
+        result.Should().BeEmpty();
+        _categoryRepositoryMock.Verify(r => r.GetAll(_userId), Times.Once);
+        _mapperMock.Verify(m => m.Map<IEnumerable<CategoryDto>>(categories), Times.Once);
+    }
+}
path: backend/tests/FinanceTracker.Application.Tests/Categories/Queries/GetAllCategories/GetAllCategoriesQueryHandlerTests.cs
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**SUGGESTION: IMPLEMENT ADDITIONAL TEST SCENARIOS.**

BEEP BOOP. CURRENT TEST COVERAGE LIMITED TO HAPPY PATH AND EMPTY COLLECTION SCENARIOS. RECOMMEND ADDING TESTS FOR:

1. ERROR HANDLING: REPOSITORY THROWS EXCEPTION
2. USER CONTEXT RETURNS NULL USER
3. INVALID USER SCENARIOS
4. EXCEPTION HANDLING VERIFICATION

THIS WOULD INCREASE TEST COVERAGE OF ERROR PATHS.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-20T19:54:46Z
author_association: NONE
diff_hunk: @@ -0,0 +1,125 @@
+﻿using AutoMapper;
+using FinanceTracker.Application.Categories.Dtos;
+using FinanceTracker.Application.Users;
+using FinanceTracker.Application.Wallets.Dtos;
+using FinanceTracker.Application.Wallets.Queries.GetAllWallets;
+using FinanceTracker.Domain.Entities;
+using FinanceTracker.Domain.Repositories;
+using FluentAssertions;
+using Microsoft.Extensions.Logging;
+using Moq;
+using Xunit;
+
+namespace FinanceTracker.Application.Categories.Queries.GetAllCategories.Tests;
+
+public class GetAllCategoriesQueryHandlerTests
+{
+    private readonly Mock<ILogger<GetAllCategoriesQueryHandler>> _loggerMock;
+    private readonly Mock<IUserContext> _userContextMock;
+    private readonly Mock<IMapper> _mapperMock;
+    private readonly Mock<ICategoryRepository> _categoryRepositoryMock;
+    private readonly GetAllCategoriesQueryHandler _handler;
+    private readonly string _userId = "test-user-id";
+
+    public GetAllCategoriesQueryHandlerTests()
+    {
+        _loggerMock = new Mock<ILogger<GetAllCategoriesQueryHandler>>();
+        _userContextMock = new Mock<IUserContext>();
+        _mapperMock = new Mock<IMapper>();
+        _categoryRepositoryMock = new Mock<ICategoryRepository>();
+
+        _handler = new GetAllCategoriesQueryHandler(
+            _loggerMock.Object,
+            _userContextMock.Object,
+            _mapperMock.Object,
+            _categoryRepositoryMock.Object
+        );
+    }
+
+    [Fact()]
+    public async Task Handle_WithValidRequest_ShouldReturnAllCategoriesForCurrentUser()
+    {
+        // Arrange
+        var query = new GetAllCategoriesQuery();
+
+        var user = new UserDto("test", "test@test.com") { Id = _userId };
+        _userContextMock.Setup(u => u.GetUser()).Returns(user);
+
+        var categories = new List<Category>
+        {
+            new Category
+            {
+                Id = 1,
+                Title = "test",
+                DefaultTransactionType = "Income",
+                UserId = _userId
+            },
+            new Category
+            {
+                Id = 2,
+                Title = "test2",
+                DefaultTransactionType = "Expense",
+                UserId = _userId
+            }
+        };
+
+        _categoryRepositoryMock.Setup(r => r.GetAll(_userId))
+            .ReturnsAsync(categories);
+
+        var categoryDtos = new List<CategoryDto>
+        {
+            new CategoryDto
+            {
+                Id = 1,
+                Title = "test",
+                DefaultTransactionType = "Income",
+            },
+            new CategoryDto
+            {
+                Id = 2,
+                Title = "test2",
+                DefaultTransactionType = "Expense",
+            }
+        };
+
+        _mapperMock.Setup(m => m.Map<IEnumerable<CategoryDto>>(categories))
+            .Returns(categoryDtos);
+
+        // Act
+        var result = await _handler.Handle(query, CancellationToken.None);
+
+        // Assert
+        result.Should().NotBeNull();
+        result.Should().BeEquivalentTo(categoryDtos);
+        _categoryRepositoryMock.Verify(r => r.GetAll(_userId), Times.Once);
+        _mapperMock.Verify(m => m.Map<IEnumerable<CategoryDto>>(categories), Times.Once);
+    }
+    [Fact()]
+    public async Task Handle_WhenNoCategories_ShouldReturnEmptyCollection()
+    {
+        // Arrange
+        var query = new GetAllCategoriesQuery();
+
+        var user = new UserDto("test", "test@test.com") { Id = _userId };
+        _userContextMock.Setup(u => u.GetUser()).Returns(user);
+
+        var categories = new List<Category>();
+
+        _categoryRepositoryMock.Setup(r => r.GetAll(_userId))
+            .ReturnsAsync(categories);
+
+        var walletDtos = new List<CategoryDto>();
path: backend/tests/FinanceTracker.Application.Tests/Categories/Queries/GetAllCategories/GetAllCategoriesQueryHandlerTests.cs
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**WARNING: VARIABLE NAME INCONSISTENCY DETECTED.**

BEEP BOOP. VARIABLE NAME DOES NOT MATCH CONTEXT. CURRENT NAME REFERENCES WALLET ENTITY INSTEAD OF CATEGORY ENTITY.

```diff
-        var walletDtos = new List<CategoryDto>();
+        var categoryDtos = new List<CategoryDto>();
```




<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
        var categoryDtos = new List<CategoryDto>();
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-20T19:54:46Z
author_association: NONE
diff_hunk: @@ -0,0 +1,125 @@
+﻿using AutoMapper;
+using FinanceTracker.Application.Categories.Dtos;
+using FinanceTracker.Application.Users;
+using FinanceTracker.Application.Wallets.Dtos;
+using FinanceTracker.Application.Wallets.Queries.GetAllWallets;
path: backend/tests/FinanceTracker.Application.Tests/Categories/Queries/GetAllCategories/GetAllCategoriesQueryHandlerTests.cs
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**DETECTED: UNNECESSARY IMPORTS. REMOVAL RECOMMENDED.**

BEEP BOOP. ANALYSIS COMPLETE. LINES 4-5 IMPORT WALLET-RELATED NAMESPACES NOT UTILIZED IN CURRENT UNIT TESTS.

```diff
-using FinanceTracker.Application.Wallets.Dtos;
-using FinanceTracker.Application.Wallets.Queries.GetAllWallets;
```




<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion

`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-20T19:54:46Z
author_association: NONE
diff_hunk: @@ -0,0 +1,52 @@
+﻿using FluentValidation.TestHelper;
+using Xunit;
+
+namespace FinanceTracker.Application.PersonalTransactions.Queries.GetReportOnCategories.Tests;
+
+public class GetReportOnCategoriesQueryValidatorTests
+{
+    [Theory()]
+    [InlineData("Bank")]
+    [InlineData("Cash")]
+    [InlineData("MFS")]
+    public void Validator_ForValidCommands_ShouldNotHaveValidationErrors(string types)
+    {
+        // Arrange
+
+        var query = new GetReportOnCategoriesQuery()
+        {
+            Type = types,
+            Days = 30
+        };
+
+        var validator = new GetReportOnCategoriesQueryValidator();
+
+        // Act
+
+        var results = validator.TestValidate(query);
+
+        // Assert
+        results.ShouldNotHaveAnyValidationErrors();
+        results.ShouldNotHaveValidationErrorFor(c => c.Days);
+    }
+    [Fact()]
+    public void Validator_ForInvalidCommands_ShouldNotHaveValidationErrors()
+    {
+        // Arrange
+
+        var query = new GetReportOnCategoriesQuery()
+        {
+            Type = "Bank",
+            Days = 3550
+        };
+
+        var validator = new GetReportOnCategoriesQueryValidator();
+
+        // Act
+
+        var results = validator.TestValidate(query);
+
+        // Assert
+        results.ShouldHaveValidationErrorFor(c => c.Days);
+    }
path: backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Queries/GetReportOnCategories/GetReportOnCategoriesQueryValidatorTests.cs
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**ERROR: INCORRECT TEST METHOD NAME DETECTED.**

TEST NAME "Validator_ForInvalidCommands_ShouldNotHaveValidationErrors" CONTRADICTS EXPECTED BEHAVIOR. LOGIC CONFIRMS THAT VALIDATION ERRORS ARE EXPECTED FOR INVALID COMMAND.

```diff
-    public void Validator_ForInvalidCommands_ShouldNotHaveValidationErrors()
+    public void Validator_ForInvalidCommands_ShouldHaveValidationErrors()
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
    [Fact()]
    public void Validator_ForInvalidCommands_ShouldHaveValidationErrors()
    {
        // Arrange

        var query = new GetReportOnCategoriesQuery()
        {
            Type = "Bank",
            Days = 3550
        };

        var validator = new GetReportOnCategoriesQueryValidator();

        // Act

        var results = validator.TestValidate(query);

        // Assert
        results.ShouldHaveValidationErrorFor(c => c.Days);
    }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-20T19:54:46Z
author_association: NONE
diff_hunk: @@ -0,0 +1,27 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <LangVersion>latest</LangVersion>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="FluentAssertions" Version="8.2.0" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
+    <PackageReference Include="Moq" Version="4.20.72" />
+    <PackageReference Include="MSTest" Version="3.6.4" />
+    <PackageReference Include="xunit" Version="2.9.3" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\FinanceTracker.Api\FinanceTracker.Api.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
+  </ItemGroup>
+
+</Project>
path: backend/src/FinanceTracker.Api.Tests/FinanceTracker.Api.Tests.csproj
user: login: coderabbitai[bot]
body: _💡 Verification agent_

<details>
<summary>🧩 Analysis chain</summary>

**TEST PROJECT CONFIGURATION ANALYSIS COMPLETE.**

BEEP. TEST PROJECT PROPERLY CONFIGURED WITH REQUIRED DEPENDENCIES AND SETTINGS. OBSERVATION: DUAL TESTING FRAMEWORKS (MSTest AND xUnit) DETECTED.


---

🌐 Web query:

```web
Is it a good practice to mix MSTest and xUnit in the same test project?
```

💡 Result:

Mixing MSTest and xUnit within the same test project is generally not recommended as a best practice. Here are the key reasons and considerations:

## Technical Feasibility and Tooling Issues

- It is technically possible to include both MSTest and xUnit tests in the same project or assembly, and most modern .NET test runners (including those in Visual Studio and ReSharper) can discover and execute tests from multiple frameworks within a solution[2][7]. However, users have reported inconsistent behavior in some tooling—like Visual Studio’s test explorer or ReSharper—where running “all tests” may not always execute tests from both frameworks reliably without manual selection or updated test adapters[2].
- Some runners may only execute one framework’s tests at a time, leaving the tests from the other framework unexecuted or marked as “inconclusive”, thus reducing confidence in test coverage and automation reliability[2].

## Best Practices and Maintainability

- Most guidance on test framework selection encourages picking a single framework per test assembly for consistency, maintainability, and to avoid confusion among team members[6][8].
- Mixing frameworks introduces extra maintenance overhead. Developers must remember different attribute names, lifecycle concepts (e.g., `[Fact]` vs. `[TestMethod]`, constructor behavior, setup/teardown), and may encounter subtle, framework-specific bugs[6].
- Documentation and onboarding are simpler when there is only one framework to learn and reference.

## Recommendations from Experienced Developers

- xUnit is generally preferred over MSTest in modern .NET development due to its simpler object lifecycle, more active support, and improved integration with .NET Core/.NET 5+ tooling[6][8].
- MSTest is considered a legacy choice unless you are maintaining or extending an existing MSTest codebase[6].

## Summary Table

| Aspect                | MSTest & xUnit Mixed | Single Framework (Recommended) |
|-----------------------|---------------------|-------------------------------|
| Tooling Reliability   | Sometimes inconsistent[2] | Consistent, predictable      |
| Ease of Maintenance   | Lower               | Higher                        |
| Team Clarity          | Lower               | Higher                        |
| Best Practice         | Not recommended[6][8] | Strongly recommended         |

## Conclusion

While mixing MSTest and xUnit in the same test project is technically possible, it is not considered a good practice due to potential tooling inconsistencies, higher maintenance costs, and loss of clarity for collaborators. Choose a single test framework per project or assembly and migrate old tests when possible for the best developer experience[6][8].

Citations:

- 1: https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices
- 2: https://resharper-support.jetbrains.com/hc/en-us/community/posts/206660175-Running-MSTest-and-xUnit-during-the-same-test-session
- 3: https://dev.to/leandroveiga/ultimate-guide-to-effective-unit-testing-in-net-from-beginner-to-advanced-289
- 4: https://www.brendanconnolly.net/organizing-tests-with-xunit-traits/
- 5: https://www.jimmybogard.com/integration-testing-with-xunit/
- 6: https://www.brandonpugh.com/better-way/development-guidelines/testing/framework-selection.html
- 7: https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-dotnet-test
- 8: https://www.headspin.io/blog/nunit-vs-xunit-vs-mstest
- 9: https://www.youtube.com/watch?v=n1QYEzuRhkI
- 10: https://developercommunity.visualstudio.com/content/problem/939146/vs2019-cant-create-a-unit-test-project-for-net-cor.html

---



</details>

**ACTION REQUIRED: CONSOLIDATE TO A SINGLE TEST FRAMEWORK.**  
BEEP. Mixing MSTest and xUnit in the same project is not recommended due to tooling inconsistencies and increased maintenance overhead. Please choose one framework per test assembly.

Locations to update:  
- backend/src/FinanceTracker.Api.Tests/FinanceTracker.Api.Tests.csproj  
  • If you standardize on **xUnit**, remove:  
    - `<PackageReference Include="MSTest" Version="3.6.4" />`  
    - `<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />`  
  • If you standardize on **MSTest**, remove:  
    - `<PackageReference Include="xunit" Version="2.9.3" />`  
    - `<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" />`

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-20T19:54:46Z
author_association: NONE
diff_hunk: @@ -0,0 +1,90 @@
+﻿using Castle.Core.Logging;
+using FinanceTracker.Domain.Entities;
+using FinanceTracker.Domain.Exceptions;
+using FluentAssertions;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Moq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace FinanceTracker.Api.Middlewares.Tests;
+
+public class ExceptionHandlingMiddlewareTests
+{
+    [Fact()]
+    public async Task InvokeAsync_WhenNoExceptionThrown_ShouldCallNextDelegate()
+    {
+        // Arrange
+
+        var loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
+        var middleware = new ExceptionHandlingMiddleware(loggerMock.Object);
+        var context = new DefaultHttpContext();
+        var nextDelegateMock = new Mock<RequestDelegate>();
+
+        // Act
+
+        await middleware.InvokeAsync(context, nextDelegateMock.Object);
+
+        // Assert
+
+        nextDelegateMock.Verify(next => next.Invoke(context), Times.Once);
+    }
+
+    [Fact()]
+    public async Task InvokeAsync_WhenNotFoundExceptionThrown_ShouldSetStatusNotFound()
+    {
+        // Arrange
+
+        var loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
+        var middleware = new ExceptionHandlingMiddleware(loggerMock.Object);
+        var context = new DefaultHttpContext();
+        var notFoundException = new NotFoundException(nameof(Wallet), "1");
+
+        // Act
+
+        await middleware.InvokeAsync(context, _=> throw notFoundException);
+
+        // Assert
+
+        context.Response.StatusCode.Should().Be(404);
+    }
+
+    [Fact()]
+    public async Task InvokeAsync_WhenForbidExceptionThrown_ShouldSetStatusForbidden()
+    {
+        // Arrange
+
+        var loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
+        var middleware = new ExceptionHandlingMiddleware(loggerMock.Object);
+        var context = new DefaultHttpContext();
+        var exception = new ForbiddenException();
+
+        // Act
+
+        await middleware.InvokeAsync(context, _ => throw exception);
+
+        // Assert
+
+        context.Response.StatusCode.Should().Be(403);
+    }
+
+    [Fact()]
+    public async Task InvokeAsync_WhenGenericExceptionThrown_ShouldSetStatusInternalServerError()
+    {
+        // Arrange
+
+        var loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
+        var middleware = new ExceptionHandlingMiddleware(loggerMock.Object);
+        var context = new DefaultHttpContext();
+        var exception = new Exception();
+
+        // Act
+
+        await middleware.InvokeAsync(context, _ => throw exception);
+
+        // Assert
+
+        context.Response.StatusCode.Should().Be(500);
+    }
path: backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**CODE DUPLICATION IN TEST SETUP DETECTED.**

REPEATING INITIALIZATION PATTERN OBSERVED ACROSS ALL TEST METHODS. RECOMMEND IMPLEMENTATION OF SETUP METHOD OR TEST FIXTURE TO INITIALIZE COMMON OBJECTS.


SUGGESTED IMPLEMENTATION:

```csharp
public class ExceptionHandlingMiddlewareTests
{
    private Mock<ILogger<ExceptionHandlingMiddleware>> _loggerMock;
    private ExceptionHandlingMiddleware _middleware;
    private DefaultHttpContext _context;

    public ExceptionHandlingMiddlewareTests()
    {
        _loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
        _middleware = new ExceptionHandlingMiddleware(_loggerMock.Object);
        _context = new DefaultHttpContext();
    }

    // EXISTING TEST METHODS MODIFIED TO USE THESE FIELDS
}
```

THIS MODIFICATION WOULD REDUCE REDUNDANCY AND IMPROVE MAINTAINABILITY OF TESTS.

---

_🛠️ Refactor suggestion_

**LOGGING VERIFICATION MISSING IN EXCEPTION TESTS.**

ANALYSIS: LOGGER MOCK IS INITIALIZED BUT VERIFICATION THAT EXCEPTIONS ARE PROPERLY LOGGED IS ABSENT. RECOMMENDATION: IMPLEMENT VERIFICATION OF LOGGING BEHAVIOR.


EXAMPLE IMPLEMENTATION FOR NOTFOUNDEXCEPTION TEST:

```diff
         // Assert

         context.Response.StatusCode.Should().Be(404);
+        loggerMock.Verify(
+            x => x.Log(
+                LogLevel.Information,
+                It.IsAny<EventId>(),
+                It.Is<It.IsAnyType>((o, t) => o.ToString().Contains(notFoundException.Message)),
+                notFoundException,
+                It.IsAny<Func<It.IsAnyType, Exception, string>>()),
+            Times.Once);
```

APPLY SIMILAR VERIFICATION TO ALL EXCEPTION HANDLING TESTS.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-20T19:54:46Z
author_association: NONE
diff_hunk: @@ -0,0 +1,90 @@
+﻿using Castle.Core.Logging;
+using FinanceTracker.Domain.Entities;
+using FinanceTracker.Domain.Exceptions;
+using FluentAssertions;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Moq;
+using System.Threading.Tasks;
+using Xunit;
+
path: backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**DETECTED UNUSED IMPORT STATEMENT.**

SCANNING IMPORT DIRECTIVES... `Castle.Core.Logging` IS IMPORTED BUT NEVER UTILIZED IN CODE. SUGGEST REMOVAL FOR OPTIMAL CODE CLEANLINESS.

```diff
-﻿using Castle.Core.Logging;
 using FinanceTracker.Domain.Entities;
 using FinanceTracker.Domain.Exceptions;
 using FluentAssertions;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Logging;
 using Moq;
 using System.Threading.Tasks;
 using Xunit;
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
// File: backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs
using FinanceTracker.Domain.Entities;
using FinanceTracker.Domain.Exceptions;
using FluentAssertions;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Moq;
using System.Threading.Tasks;
using Xunit;
`````

</details>

<!-- suggestion_end -->

---

_🧹 Nitpick (assertive)_

**MISSING SYSTEM EXCEPTION IMPORT.**

DETECTED UNIMPORTED TYPE USAGE. SYSTEM.EXCEPTION UTILIZED IN LINE 80 BUT NOT EXPLICITLY IMPORTED.

```diff
 using FinanceTracker.Domain.Entities;
 using FinanceTracker.Domain.Exceptions;
 using FluentAssertions;
 using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Logging;
 using Moq;
+using System;
 using System.Threading.Tasks;
 using Xunit;
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
﻿using Castle.Core.Logging;
using FinanceTracker.Domain.Entities;
using FinanceTracker.Domain.Exceptions;
using FluentAssertions;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Moq;
using System;
using System.Threading.Tasks;
using Xunit;
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-20T19:54:46Z
author_association: NONE
diff_hunk: @@ -0,0 +1,90 @@
+﻿using Castle.Core.Logging;
+using FinanceTracker.Domain.Entities;
+using FinanceTracker.Domain.Exceptions;
+using FluentAssertions;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Moq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace FinanceTracker.Api.Middlewares.Tests;
path: backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**NAMESPACE STRUCTURE INCONSISTENT WITH PROJECT HIERARCHY.**

DETECTED NAMESPACE INCONSISTENCY. NAMESPACE TERMINATES WITH `.Tests` WHILE PROJECT NAME IS `FinanceTracker.Api.Tests`. RECOMMEND RESTRUCTURING FOR LOGICAL CONSISTENCY.

```diff
-namespace FinanceTracker.Api.Middlewares.Tests;
+namespace FinanceTracker.Api.Tests.Middlewares;
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
namespace FinanceTracker.Api.Tests.Middlewares;
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-20T19:54:46Z
author_association: NONE
diff_hunk: @@ -0,0 +1,90 @@
+﻿using Castle.Core.Logging;
+using FinanceTracker.Domain.Entities;
+using FinanceTracker.Domain.Exceptions;
+using FluentAssertions;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Moq;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace FinanceTracker.Api.Middlewares.Tests;
+
+public class ExceptionHandlingMiddlewareTests
+{
+    [Fact()]
+    public async Task InvokeAsync_WhenNoExceptionThrown_ShouldCallNextDelegate()
+    {
+        // Arrange
+
+        var loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
+        var middleware = new ExceptionHandlingMiddleware(loggerMock.Object);
+        var context = new DefaultHttpContext();
+        var nextDelegateMock = new Mock<RequestDelegate>();
+
+        // Act
+
+        await middleware.InvokeAsync(context, nextDelegateMock.Object);
+
+        // Assert
+
+        nextDelegateMock.Verify(next => next.Invoke(context), Times.Once);
+    }
+
+    [Fact()]
+    public async Task InvokeAsync_WhenNotFoundExceptionThrown_ShouldSetStatusNotFound()
+    {
+        // Arrange
+
+        var loggerMock = new Mock<ILogger<ExceptionHandlingMiddleware>>();
+        var middleware = new ExceptionHandlingMiddleware(loggerMock.Object);
+        var context = new DefaultHttpContext();
+        var notFoundException = new NotFoundException(nameof(Wallet), "1");
+
+        // Act
+
+        await middleware.InvokeAsync(context, _=> throw notFoundException);
path: backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**LAMBDA SYNTAX FORMATTING ERROR DETECTED.**

UNNECESSARY WHITESPACE DETECTED BETWEEN UNDERSCORE AND ARROW OPERATOR.

```diff
-        await middleware.InvokeAsync(context, _=> throw notFoundException);
+        await middleware.InvokeAsync(context, _ => throw notFoundException);
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
        await middleware.InvokeAsync(context, _ => throw notFoundException);
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-20T19:54:46Z
author_association: NONE

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-04-20T19:52:07Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

<details>
<summary>📝 Walkthrough</summary>

## Summary by CodeRabbit

- **Tests**
  - Added unit tests for exception handling middleware, category query handler, personal transaction command handler, report query validator, and user context.
  - Improved test coverage for edge cases and validation scenarios.
  - Introduced a new test project for API testing.
## Walkthrough

Beep boop. The changes introduce new automated tests for the FinanceTracker solution. A new test project, `FinanceTracker.Api.Tests`, is added to the solution and includes tests for middleware exception handling. Additional unit tests are implemented for application logic, including category queries, personal transaction commands and queries, and user context edge cases. The solution file is updated to reference the new test project and its build configurations. No changes are made to the core application logic; all updates are related to test coverage and validation.

## Changes

| File(s)                                                                                                   | Change Summary                                                                                                   |
|-----------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| FinanceTracker.sln                                                                                        | Solution file updated to include new `FinanceTracker.Api.Tests` project and its build configurations.            |
| backend/src/FinanceTracker.Api.Tests/FinanceTracker.Api.Tests.csproj                                      | New .NET test project file created for API tests, with references to test libraries and the main API project.    |
| backend/src/FinanceTracker.Api.Tests/Middlewares/ExceptionHandlingMiddlewareTests.cs                      | New test class for `ExceptionHandlingMiddleware`, covering exception scenarios and HTTP status responses.         |
| backend/tests/FinanceTracker.Application.Tests/Categories/Queries/GetAllCategories/GetAllCategoriesQueryHandlerTests.cs | New test class for `GetAllCategoriesQueryHandler`, verifying correct category retrieval and empty result cases.   |
| backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Commands/CreatePersonalTransaction/CreatePersonalTransactionCommandHandlerTests.cs | Added test for forbidden exception when category is null in transaction creation.                                |
| backend/tests/FinanceTracker.Application.Tests/PersonalTransactions/Queries/GetReportOnCategories/GetReportOnCategoriesQueryValidatorTests.cs | New test class for validating `GetReportOnCategoriesQuery`, covering valid and invalid input scenarios.           |
| backend/tests/FinanceTracker.Application.Tests/Users/UserContextTests.cs                                  | Added two edge case tests for `GetUser()` method in `UserContextTests`.                                          |

## Poem

> 0101, the tests arrive,  
> To catch the bugs and verify.  
> Middleware, queries, categories, too,  
> Each scenario now gets its due.  
> With mocks and asserts, the bots march on—  
> FinanceTracker’s code is strong at dawn!  
> 🤖✨

</details>

<!-- walkthrough_end -->

<!-- announcements_start -->

> [!TIP]
> <details>
> <summary>⚡💬 Agentic Chat (Pro Plan, General Availability)</summary>
> 
> - We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.
> 
> </details>

<!-- announcements_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEejqANiS7RpuAwDlszAZS4AWAJwGAqojeQVABm8PgAjAAMAEwRRvrG4FBk9PhBOATEZMo09Eys7Fy8/MKi4lIy8kxKVKrqWjrxJlBwqKiY6YSk5FQ5CvkYnIFoAO6QiM7MaBTycgrVKmqa2rpghgmmBgBi8BiYDCTQVAwA1pQaiBYYHAYARHcGAMQPkACCAJKZ3dR0YxNT8qlGLBMKREGZYCQxvgLHhQlgQlZIAADba7DD7Q5oE5nC4YJGQYZoZDYbi0b70AgodEwpToSDkUa8fAiMT0tBsegonZ7A5HU4UDQvbjwDS2RC4RBIjQwBDIJks3AoZAWfAMcnoRVIgRY04YWgAHUQFAY+tRPMx2IFQpFYolpu56N5OrO1tFdkQGgYiHl+Mw9GByFwEMgAHEfG8ACLIgDeYQAwgB2TwAIQArMmAKJgOMANlT7jA7ncOYAHGAS6mwmWI1EwpsM14S5EXu4AL5SyBx/AUCjSbj4PU7IiQdgUeDSAmUSFoWhKCn4SBByFIkMq7UWADKpThAAoAAoUZmlLsYEJEbA9OF7izUILd5iIACU+MpShC5EgAmw8AsuQHZ4vag4WQO8+CDVAGR4Q8FQAGjGbhRHgIJZCHT98CDSAIxIL9hz9SAACUSCsIlISYU94HPS8BxA7tXgweQ4z3HweBvXBQ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6PHF6LsOrDrBJDiSAjhOdCJnqh5CG6DBUCjByMzD+HzC1BLANBmtNB9Ccq4AUYjKIAUa9jTKix0AUZCphQrBrA+tNQCAtRBAlgJglhNQJi0A5hoCRBhAkDFhRACCeAJjZuuAQyphNS0Cph7N5slhRDRvmu+vqABskMhvjgWS0AUbJDRtAA -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=Learnathon-By-Geeky-Solutions/procastinators&utm_content=49):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: NONE
user: login: sonarqubecloud[bot]
created_at: 2025-04-20T19:53:22Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=Learnathon-By-Geeky-Solutions_procastinators&pullRequest=49) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=Learnathon-By-Geeky-Solutions_procastinators&pullRequest=49&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=Learnathon-By-Geeky-Solutions_procastinators&pullRequest=49&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=Learnathon-By-Geeky-Solutions_procastinators&pullRequest=49&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=Learnathon-By-Geeky-Solutions_procastinators&pullRequest=49&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=Learnathon-By-Geeky-Solutions_procastinators&pullRequest=49&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=Learnathon-By-Geeky-Solutions_procastinators&pullRequest=49)


author_association: NONE