diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 3a83f9671..36ad4b2aa 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -8,9 +8,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v3 with: dotnet-version: '8.0.x' include-prerelease: true diff --git a/.github/workflows/richnav.yml b/.github/workflows/richnav.yml index 1202a15a9..2f92726af 100644 --- a/.github/workflows/richnav.yml +++ b/.github/workflows/richnav.yml @@ -8,9 +8,9 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x diff --git a/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs b/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs index 45e9ecccb..e947c4d57 100644 --- a/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs +++ b/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs @@ -1,23 +1,19 @@ using System; - -namespace Microsoft.eShopWeb.ApplicationCore.Exceptions; - -public class EmptyBasketOnCheckoutException : Exception +namespace Microsoft.eShopWeb.ApplicationCore.Exceptions { - public EmptyBasketOnCheckoutException() - : base($"Basket cannot have 0 items on checkout") + public class EmptyBasketOnCheckoutException : Exception { - } + public EmptyBasketOnCheckoutException() + : base($"Basket cannot have 0 items on checkout") + { + } - protected EmptyBasketOnCheckoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) - { - } + public EmptyBasketOnCheckoutException(string message) : base(message) + { + } - public EmptyBasketOnCheckoutException(string message) : base(message) - { - } - - public EmptyBasketOnCheckoutException(string message, Exception innerException) : base(message, innerException) - { + public EmptyBasketOnCheckoutException(string message, Exception innerException) : base(message, innerException) + { + } } } diff --git a/tests/IntegrationTests/Repositories/BasketRepositoryTests/SetQuantities.cs b/tests/IntegrationTests/Repositories/BasketRepositoryTests/SetQuantities.cs index 95ba0e3e0..b17e7d3f8 100644 --- a/tests/IntegrationTests/Repositories/BasketRepositoryTests/SetQuantities.cs +++ b/tests/IntegrationTests/Repositories/BasketRepositoryTests/SetQuantities.cs @@ -35,6 +35,6 @@ public async Task RemoveEmptyQuantities() await basketService.SetQuantities(BasketBuilder.BasketId, new Dictionary() { { BasketBuilder.BasketId.ToString(), 0 } }); - Assert.Equal(0, basket.Items.Count); + Assert.Empty(basket.Items); } } diff --git a/tests/UnitTests/ApplicationCore/Entities/BasketTests/BasketRemoveEmptyItems.cs b/tests/UnitTests/ApplicationCore/Entities/BasketTests/BasketRemoveEmptyItems.cs index 58aebb42f..585f72b26 100644 --- a/tests/UnitTests/ApplicationCore/Entities/BasketTests/BasketRemoveEmptyItems.cs +++ b/tests/UnitTests/ApplicationCore/Entities/BasketTests/BasketRemoveEmptyItems.cs @@ -16,6 +16,6 @@ public void RemovesEmptyBasketItems() basket.AddItem(_testCatalogItemId, _testUnitPrice, 0); basket.RemoveEmptyItems(); - Assert.Equal(0, basket.Items.Count); + Assert.Empty(basket.Items); } } diff --git a/tests/UnitTests/ApplicationCore/Specifications/CustomerOrdersWithItemsSpecification.cs b/tests/UnitTests/ApplicationCore/Specifications/CustomerOrdersWithItemsSpecification.cs index 0a066d075..88ad0a20d 100644 --- a/tests/UnitTests/ApplicationCore/Specifications/CustomerOrdersWithItemsSpecification.cs +++ b/tests/UnitTests/ApplicationCore/Specifications/CustomerOrdersWithItemsSpecification.cs @@ -19,7 +19,7 @@ public void ReturnsOrderWithOrderedItem() Assert.NotNull(result); Assert.NotNull(result.OrderItems); - Assert.Equal(1, result.OrderItems.Count); + Assert.Single(result.OrderItems); Assert.NotNull(result.OrderItems.FirstOrDefault()?.ItemOrdered); } @@ -32,9 +32,9 @@ public void ReturnsAllOrderWithAllOrderedItem() Assert.NotNull(result); Assert.Equal(2, result.Count); - Assert.Equal(1, result[0].OrderItems.Count); + Assert.Single(result[0].OrderItems); Assert.NotNull(result[0].OrderItems.FirstOrDefault()?.ItemOrdered); - Assert.Equal(2, result[1].OrderItems.Count); + Assert.Single(result[1].OrderItems); Assert.NotNull(result[1].OrderItems.ToList()[0].ItemOrdered); Assert.NotNull(result[1].OrderItems.ToList()[1].ItemOrdered); }