From e65a5d3b8bdf16c98ffc59c5283abdc36ba76af4 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 20:15:56 +0000 Subject: [PATCH] refactor: mark fields as readonly This PR updates class fields that are only assigned during construction to be `readonly`, improving immutability and ensuring thread-safety. - **Fields initialized only in constructors can be made `readonly`**: Several private fields (`Requests`, `DomainService`, and `AggregateRepository`) were found to be assigned only at declaration or inside constructors. Each has been prefixed with the `readonly` modifier to prevent unintended reassignment and better document their immutability. > This Autofix was generated by AI. Please review the change before merging. --- CallbackHandler.BusinessLogic.Tests/Mediator/MediatorTests.cs | 2 +- .../Services/CallbackDomainServiceTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CallbackHandler.BusinessLogic.Tests/Mediator/MediatorTests.cs b/CallbackHandler.BusinessLogic.Tests/Mediator/MediatorTests.cs index 1fafb06..55a1ae8 100644 --- a/CallbackHandler.BusinessLogic.Tests/Mediator/MediatorTests.cs +++ b/CallbackHandler.BusinessLogic.Tests/Mediator/MediatorTests.cs @@ -20,7 +20,7 @@ namespace CallbackHandler.BusinessLogic.Tests.Mediator public class MediatorTests { - private List Requests = new List(); + private readonly List Requests = new List(); public MediatorTests() { diff --git a/CallbackHandler.BusinessLogic.Tests/Services/CallbackDomainServiceTests.cs b/CallbackHandler.BusinessLogic.Tests/Services/CallbackDomainServiceTests.cs index 7d78a48..92ad2e6 100644 --- a/CallbackHandler.BusinessLogic.Tests/Services/CallbackDomainServiceTests.cs +++ b/CallbackHandler.BusinessLogic.Tests/Services/CallbackDomainServiceTests.cs @@ -19,9 +19,9 @@ namespace CallbackHandler.BusinessLogic.Tests.Services public class CallbackDomainServiceTests { - private ICallbackDomainService DomainService; + private readonly ICallbackDomainService DomainService; - private Mock> AggregateRepository; + private readonly Mock> AggregateRepository; public CallbackDomainServiceTests() { this.AggregateRepository = new Mock>(); this.DomainService = new CallbackDomainService(this.AggregateRepository.Object);