mirror of
https://github.com/valentincanonical/eShopOnWeb-chisel-demo.git
synced 2026-02-14 09:39:53 +00:00
* 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.
22 lines
660 B
C#
22 lines
660 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
|
|
using Microsoft.eShopWeb.ApplicationCore.Exceptions;
|
|
|
|
namespace Ardalis.GuardClauses;
|
|
|
|
public static class BasketGuards
|
|
{
|
|
public static void NullBasket(this IGuardClause guardClause, int basketId, Basket basket)
|
|
{
|
|
if (basket == null)
|
|
throw new BasketNotFoundException(basketId);
|
|
}
|
|
|
|
public static void EmptyBasketOnCheckout(this IGuardClause guardClause, IReadOnlyCollection<BasketItem> basketItems)
|
|
{
|
|
if (!basketItems.Any())
|
|
throw new EmptyBasketOnCheckoutException();
|
|
}
|
|
}
|