From 3e7df0c24c05b42bb4ce8ac9619e79667b09bf7e Mon Sep 17 00:00:00 2001 From: SilentSobs Date: Fri, 2 Feb 2024 18:59:25 +0530 Subject: [PATCH 01/10] workflow update --- .github/workflows/dotnetcore.yml | 4 ++-- .github/workflows/richnav.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 3a83f9671..32f9cb8e3 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@v4 with: dotnet-version: '8.0.x' include-prerelease: true diff --git a/.github/workflows/richnav.yml b/.github/workflows/richnav.yml index 1202a15a9..ba6c3e8af 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@v4 with: dotnet-version: 8.0.x From ad1090b8905919315430a8ba2bfa3e5bb10ea982 Mon Sep 17 00:00:00 2001 From: SilentSobs Date: Fri, 2 Feb 2024 19:28:14 +0530 Subject: [PATCH 02/10] updates warning --- .../Exceptions/EmptyBasketOnCheckoutException.cs | 3 ++- .../Repositories/BasketRepositoryTests/SetQuantities.cs | 2 +- .../Entities/BasketTests/BasketRemoveEmptyItems.cs | 2 +- .../CustomerOrdersWithItemsSpecification.cs | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs b/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs index 45e9ecccb..f75b239b1 100644 --- a/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs +++ b/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs @@ -9,7 +9,8 @@ public EmptyBasketOnCheckoutException() { } - protected EmptyBasketOnCheckoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) + protected EmptyBasketOnCheckoutException() + : base("An exception occurred due to an empty basket during checkout.") { } 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..b4df40412 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); } @@ -31,10 +31,10 @@ public void ReturnsAllOrderWithAllOrderedItem() var result = spec.Evaluate(GetTestCollection()).ToList(); Assert.NotNull(result); - Assert.Equal(2, result.Count); - Assert.Equal(1, result[0].OrderItems.Count); + Assert.Single(result); + 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); } From 458e4c46085d674414a8051bcd399c56a9dee2e7 Mon Sep 17 00:00:00 2001 From: SilentSobs Date: Fri, 2 Feb 2024 19:33:27 +0530 Subject: [PATCH 03/10] Update EmptyBasketOnCheckoutException.cs --- .../Exceptions/EmptyBasketOnCheckoutException.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs b/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs index f75b239b1..45e9ecccb 100644 --- a/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs +++ b/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs @@ -9,8 +9,7 @@ public EmptyBasketOnCheckoutException() { } - protected EmptyBasketOnCheckoutException() - : base("An exception occurred due to an empty basket during checkout.") + protected EmptyBasketOnCheckoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } From 6bde518dc0b65de7ee527897998b03906fdbce29 Mon Sep 17 00:00:00 2001 From: SilentSobs Date: Fri, 2 Feb 2024 19:37:56 +0530 Subject: [PATCH 04/10] Update EmptyBasketOnCheckoutException.cs --- .../EmptyBasketOnCheckoutException.cs | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs b/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs index 45e9ecccb..d0fa6c721 100644 --- a/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs +++ b/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs @@ -1,23 +1,22 @@ using System; -namespace Microsoft.eShopWeb.ApplicationCore.Exceptions; +using System; -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) + { + } } } From b247b26e889969837d5d4b1483ecbea7333db317 Mon Sep 17 00:00:00 2001 From: SilentSobs Date: Fri, 2 Feb 2024 19:40:30 +0530 Subject: [PATCH 05/10] Update EmptyBasketOnCheckoutException.cs --- .../Exceptions/EmptyBasketOnCheckoutException.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs b/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs index d0fa6c721..e947c4d57 100644 --- a/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs +++ b/src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs @@ -1,7 +1,4 @@ using System; - -using System; - namespace Microsoft.eShopWeb.ApplicationCore.Exceptions { public class EmptyBasketOnCheckoutException : Exception From 67d1cc29a10b1cf8bc3a54d97fc5b7f1c6874115 Mon Sep 17 00:00:00 2001 From: SilentSobs Date: Fri, 2 Feb 2024 19:42:44 +0530 Subject: [PATCH 06/10] Update dotnetcore.yml --- .github/workflows/dotnetcore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 32f9cb8e3..36ad4b2aa 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v3 with: dotnet-version: '8.0.x' include-prerelease: true From 831efb91a78648bf366e2b06f274b4aacffb163d Mon Sep 17 00:00:00 2001 From: SilentSobs Date: Fri, 2 Feb 2024 19:44:49 +0530 Subject: [PATCH 07/10] Update richnav.yml --- .github/workflows/richnav.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/richnav.yml b/.github/workflows/richnav.yml index ba6c3e8af..2f92726af 100644 --- a/.github/workflows/richnav.yml +++ b/.github/workflows/richnav.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup .NET Core - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x From 30a611dce21cbc4daa9e49c8dbf72d010c1abdb0 Mon Sep 17 00:00:00 2001 From: SilentSobs Date: Fri, 2 Feb 2024 19:47:09 +0530 Subject: [PATCH 08/10] v1 --- .github/workflows/dotnetcore.yml | 2 +- .github/workflows/richnav.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 36ad4b2aa..59ec6fdeb 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v1 with: dotnet-version: '8.0.x' include-prerelease: true diff --git a/.github/workflows/richnav.yml b/.github/workflows/richnav.yml index 2f92726af..0bb391bc6 100644 --- a/.github/workflows/richnav.yml +++ b/.github/workflows/richnav.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup .NET Core - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v1 with: dotnet-version: 8.0.x From 361fdbc55222f518175b47ffbbbfef9f15caa030 Mon Sep 17 00:00:00 2001 From: SilentSobs Date: Fri, 2 Feb 2024 19:53:23 +0530 Subject: [PATCH 09/10] Update CustomerOrdersWithItemsSpecification.cs --- .../Specifications/CustomerOrdersWithItemsSpecification.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/UnitTests/ApplicationCore/Specifications/CustomerOrdersWithItemsSpecification.cs b/tests/UnitTests/ApplicationCore/Specifications/CustomerOrdersWithItemsSpecification.cs index b4df40412..88ad0a20d 100644 --- a/tests/UnitTests/ApplicationCore/Specifications/CustomerOrdersWithItemsSpecification.cs +++ b/tests/UnitTests/ApplicationCore/Specifications/CustomerOrdersWithItemsSpecification.cs @@ -31,7 +31,7 @@ public void ReturnsAllOrderWithAllOrderedItem() var result = spec.Evaluate(GetTestCollection()).ToList(); Assert.NotNull(result); - Assert.Single(result); + Assert.Equal(2, result.Count); Assert.Single(result[0].OrderItems); Assert.NotNull(result[0].OrderItems.FirstOrDefault()?.ItemOrdered); Assert.Single(result[1].OrderItems); From a85f2474c4c293c3347f93432d2341de430d76ab Mon Sep 17 00:00:00 2001 From: SilentSobs Date: Fri, 2 Feb 2024 20:03:19 +0530 Subject: [PATCH 10/10] final-update --- .github/workflows/dotnetcore.yml | 2 +- .github/workflows/richnav.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 59ec6fdeb..36ad4b2aa 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -10,7 +10,7 @@ jobs: steps: - 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 0bb391bc6..2f92726af 100644 --- a/.github/workflows/richnav.yml +++ b/.github/workflows/richnav.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x