Adding additional unit tests (#406)
* Creating new test class for RemoveEmptyItems * Adding tests for AddItemToBasket in BasketService * Removing unused GetBasketItemCountAsync * Adding tests for BasketWithItemsSpecification * Adding CustomerORdersWithItemsSpecification tests * Adding CatalogFilterPaginatedSpecifciation tests * Adding CatalogItemsSpecification tests
This commit is contained in:
@@ -56,16 +56,6 @@ namespace Microsoft.eShopWeb.UnitTests.ApplicationCore.Entities.BasketTests
|
||||
Assert.Equal(1, firstItem.Quantity);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RemoveEmptyItems()
|
||||
{
|
||||
var basket = new Basket(_buyerId);
|
||||
basket.AddItem(_testCatalogItemId, _testUnitPrice, 0);
|
||||
basket.RemoveEmptyItems();
|
||||
|
||||
Assert.Equal(0, basket.Items.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CantAddItemWithNegativeQuantity()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.eShopWeb.UnitTests.ApplicationCore.Entities.BasketTests
|
||||
{
|
||||
public class BasketRemoveEmptyItems
|
||||
{
|
||||
private readonly int _testCatalogItemId = 123;
|
||||
private readonly decimal _testUnitPrice = 1.23m;
|
||||
private readonly string _buyerId = "Test buyerId";
|
||||
|
||||
[Fact]
|
||||
public void RemovesEmptyBasketItems()
|
||||
{
|
||||
var basket = new Basket(_buyerId);
|
||||
basket.AddItem(_testCatalogItemId, _testUnitPrice, 0);
|
||||
basket.RemoveEmptyItems();
|
||||
|
||||
Assert.Equal(0, basket.Items.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user