Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Pull Request: Workflow Updates, Code Refactoring, and Test Enhancements #1010

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/richnav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 12 additions & 16 deletions src/ApplicationCore/Exceptions/EmptyBasketOnCheckoutException.cs
Original file line number Diff line number Diff line change
@@ -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)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public async Task RemoveEmptyQuantities()

await basketService.SetQuantities(BasketBuilder.BasketId, new Dictionary<string, int>() { { BasketBuilder.BasketId.ToString(), 0 } });

Assert.Equal(0, basket.Items.Count);
Assert.Empty(basket.Items);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ public void RemovesEmptyBasketItems()
basket.AddItem(_testCatalogItemId, _testUnitPrice, 0);
basket.RemoveEmptyItems();

Assert.Equal(0, basket.Items.Count);
Assert.Empty(basket.Items);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
Copy link
Contributor

@SrushtiPasari94 SrushtiPasari94 Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SilentSobs This test is checking count in the result not the no. of results

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok .

Assert.Single(result[1].OrderItems);
Assert.NotNull(result[1].OrderItems.ToList()[0].ItemOrdered);
Assert.NotNull(result[1].OrderItems.ToList()[1].ItemOrdered);
}
Expand Down