Skip to content

Conversation

@RubyM77777
Copy link

… for clear readability & flexible to add new Constants.

2.Added NULL & Zero Invoice checks to avoid Exceptions & to achieve Test coverage. 3.Reduce Nested IfElse to avoid confusion and improve readability 4.Repeated calculations are stored in seperate variables to reduce DB calls & improve Page Performance 5.Created private method to Calculate the payment & save the invoice (Removed repetitive code & calculations). 6.Clear variable & method names for better understanding. 7.Used repository to save instead of direct DB save (inv.Save()). 8.Added Cache to store the invoice & to avoid multiple DB calls for the same invoice reference. 9.Installed Moq & added Unit Tests. Achived Test Coverage (Positive/Negative/NULL/Empty/EdgeCase Scenarios) & all Unit Tests Passed.

… for clear readability & flexible to add new Constants.

2.Added NULL & Zero Invoice checks to avoid Exceptions & to achieve Test coverage.
3.Reduce Nested IfElse to avoid confusion and improve readability
4.Repeated calculations are stored in seperate variables to reduce DB calls & improve Page Performance
5.Created private method to Calculate the payment & save the invoice (Removed repetitive code & calculations).
6.Clear variable & method names for better understanding.
7.Used repository to save instead of direct DB save (inv.Save()).
8.Added Cache to store the invoice & to avoid multiple DB calls for the same invoice reference.
9.Installed Moq & added Unit Tests. Achived Test Coverage (Positive/Negative/NULL/Empty/EdgeCase Scenarios) & all Unit Tests Passed.
@RubyM77777 RubyM77777 marked this pull request as draft May 27, 2025 22:33
@RubyM77777 RubyM77777 marked this pull request as ready for review May 27, 2025 22:33
@RubyM77777
Copy link
Author

Made below changes:

  1. Moved all the hardcoded Response Messages & Rates into new classes for clear readability & flexible to add new Constants.
    2.Added NULL & Zero Invoice checks to avoid Exceptions & to achieve Test coverage.
    3.Reduce Nested IfElse to avoid confusion and improve readability
    4.Repeated calculations are stored in seperate variables to reduce DB calls & improve Page Performance
    5.Created private method to Calculate the payment & save the invoice (Removed repetitive code & calculations).
    6.Clear variable & method names for better understanding.
    7.Used repository to save instead of direct DB save (inv.Save()).
    8.Added Cache to store the invoice & to avoid multiple DB calls for the same invoice reference.
    9.Installed Moq & added Unit Tests. Achived Test Coverage (Positive/Negative/NULL/Empty/EdgeCase Scenarios) & all Unit Tests Passed.

@RubyM77777 RubyM77777 changed the title 1. Moved all the hardcoded Response Messages & Rates into new classes… Refactored InvoiceService | Removed Repetitive Code | Created Interface & Private Methods | Added Caching | Added Mock Unit Tests May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant