test: add Stock value object unit tests - #252
Open
varnika-dev wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR adds
Added first unit tests for the Stock value object in the Catalogs service.
Tests Added (4 tests)
Should_Create_Stock_When_All_Values_Are_Valid
→ Stock.Of(10, 5, 100) creates successfully with correct values
Should_Throw_When_Available_Exceeds_MaxStockThreshold
→ Stock.Of(600, 5, 100) throws MaxStockThresholdReachedException
Should_Throw_When_Available_Is_Zero
→ Stock.Of(0, 5, 100) throws zero stock not allowed
Should_Throw_When_RestockThreshold_Is_Zero
→ Stock.Of(10, 0, 100) throws Zero restock threshold not allowed
Also Fixed
to match locally installed .NET SDK
Why Stock
Stock is the most complex value object in the domain
it owns 3 values and enforces a cross-field business rule
(Available cannot exceed MaxStockThreshold).
It is the highest value target for unit testing.