forked from dotnet-architecture/eShopOnWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to eliminate unneeded BasketQueryService
- Loading branch information
Showing
11 changed files
with
69 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
35 changes: 35 additions & 0 deletions
35
tests/UnitTests/ApplicationCore/Entities/BasketTests/BasketTotalItems.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate; | ||
using Xunit; | ||
|
||
namespace Microsoft.eShopWeb.UnitTests.ApplicationCore.Entities.BasketTests; | ||
|
||
public class BasketTotalItems | ||
{ | ||
private readonly int _testCatalogItemId = 123; | ||
private readonly decimal _testUnitPrice = 1.23m; | ||
private readonly int _testQuantity = 2; | ||
private readonly string _buyerId = "Test buyerId"; | ||
|
||
[Fact] | ||
public void ReturnsTotalQuantityWithOneItem() | ||
{ | ||
var basket = new Basket(_buyerId); | ||
basket.AddItem(_testCatalogItemId, _testUnitPrice, _testQuantity); | ||
|
||
var result = basket.TotalItems; | ||
|
||
Assert.Equal(_testQuantity, result); | ||
} | ||
|
||
[Fact] | ||
public void ReturnsTotalQuantityWithMultipleItems() | ||
{ | ||
var basket = new Basket(_buyerId); | ||
basket.AddItem(_testCatalogItemId, _testUnitPrice, _testQuantity); | ||
basket.AddItem(_testCatalogItemId, _testUnitPrice, _testQuantity*2); | ||
|
||
var result = basket.TotalItems; | ||
|
||
Assert.Equal(_testQuantity*3, result); | ||
} | ||
} |