Skip to content

Commit

Permalink
Merge pull request dotnet-architecture#242 from dotnet-architecture/r…
Browse files Browse the repository at this point in the history
…emove-unused-dependency

BasketService no onger uses UriComposer
  • Loading branch information
efleming18 authored Apr 19, 2019
2 parents c0f0cf3 + 693c6c4 commit 1632f7f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 0 additions & 4 deletions src/ApplicationCore/Services/BasketService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Threading.Tasks;
using System.Collections.Generic;
using Microsoft.eShopWeb.ApplicationCore.Specifications;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using System.Linq;
using Ardalis.GuardClauses;
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
Expand All @@ -13,16 +12,13 @@ public class BasketService : IBasketService
{
private readonly IAsyncRepository<Basket> _basketRepository;
private readonly IAsyncRepository<BasketItem> _basketItemRepository;
private readonly IUriComposer _uriComposer;
private readonly IAppLogger<BasketService> _logger;

public BasketService(IAsyncRepository<Basket> basketRepository,
IUriComposer uriComposer,
IAppLogger<BasketService> logger,
IAsyncRepository<BasketItem> basketItemRepository)
{
_basketRepository = basketRepository;
_uriComposer = uriComposer;
_logger = logger;
_basketItemRepository = basketItemRepository;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public async Task Should_InvokeBasketRepoOnceAndBasketItemRepoTwice_Given_TwoIte
basket.AddItem(2, It.IsAny<decimal>(), It.IsAny<int>());
_mockBasketRepo.Setup(x => x.GetByIdAsync(It.IsAny<int>()))
.ReturnsAsync(basket);
var basketService = new BasketService(_mockBasketRepo.Object, null, null, _mockBasketItemRepo.Object);
var basketService = new BasketService(_mockBasketRepo.Object, null, _mockBasketItemRepo.Object);

await basketService.DeleteBasketAsync(It.IsAny<int>());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public SetQuantities()
[Fact]
public async void ThrowsGivenInvalidBasketId()
{
var basketService = new BasketService(_mockBasketRepo.Object, null, null, null);
var basketService = new BasketService(_mockBasketRepo.Object, null, null);

await Assert.ThrowsAsync<BasketNotFoundException>(async () =>
await basketService.SetQuantities(_invalidId, new System.Collections.Generic.Dictionary<string, int>()));
Expand All @@ -30,7 +30,7 @@ await Assert.ThrowsAsync<BasketNotFoundException>(async () =>
[Fact]
public async void ThrowsGivenNullQuantities()
{
var basketService = new BasketService(null, null, null, null);
var basketService = new BasketService(null, null, null);

await Assert.ThrowsAsync<ArgumentNullException>(async () =>
await basketService.SetQuantities(123, null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ public class TransferBasket
[Fact]
public async void ThrowsGivenNullAnonymousId()
{
var basketService = new BasketService(null, null, null, null);
var basketService = new BasketService(null, null, null);

await Assert.ThrowsAsync<ArgumentNullException>(async () => await basketService.TransferBasketAsync(null, "steve"));
}

[Fact]
public async void ThrowsGivenNullUserId()
{
var basketService = new BasketService(null, null, null, null);
var basketService = new BasketService(null, null, null);

await Assert.ThrowsAsync<ArgumentNullException>(async () => await basketService.TransferBasketAsync("abcdefg", null));
}
Expand Down

0 comments on commit 1632f7f

Please sign in to comment.