Files
eShopOnWeb/tests/UnitTests/Builders/BasketBuilder.cs
Shady Nagy 9db2feb930 Shady nagy/net6 (#614)
* udated to .net6

* used the .net6 version RC2

* added editconfig.

* App core new Scoped Namespaces style.

* BlazorAdmin new Scoped Namespaces style.

* Blazor Shared new Scoped Namespaces style.

* Infra new Scoped Namespaces style.

* public api new Scoped Namespaces style.

* web new Scoped Namespaces style.

* FunctionalTests new Scoped Namespaces style.

* Integrational tests new Scoped Namespaces style.

* unit tests new Scoped Namespaces style.

* update github action.

* update github action.

* change the global.
2021-11-05 19:55:48 -04:00

40 lines
848 B
C#

using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
using Moq;
namespace Microsoft.eShopWeb.UnitTests.Builders;
public class BasketBuilder
{
private Basket _basket;
public string BasketBuyerId => "testbuyerId@test.com";
public int BasketId => 1;
public BasketBuilder()
{
_basket = WithNoItems();
}
public Basket Build()
{
return _basket;
}
public Basket WithNoItems()
{
var basketMock = new Mock<Basket>(BasketBuyerId);
basketMock.SetupGet(s => s.Id).Returns(BasketId);
_basket = basketMock.Object;
return _basket;
}
public Basket WithOneBasketItem()
{
var basketMock = new Mock<Basket>(BasketBuyerId);
_basket = basketMock.Object;
_basket.AddItem(2, 3.40m, 4);
return _basket;
}
}