Skip to content

Commit

Permalink
changed method name (dotnet-architecture#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
yigith authored Oct 24, 2021
1 parent 65b8e59 commit 97320e1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public AddItemToBasket()
}

[Fact]
public async Task InvokesBasketRepositoryGetByIdAsyncOnce()
public async Task InvokesBasketRepositoryFirstOrDefaultAsyncOnce()
{
var basket = new Basket(_buyerId);
basket.AddItem(1, It.IsAny<decimal>(), It.IsAny<int>());
Expand All @@ -29,21 +29,21 @@ public async Task InvokesBasketRepositoryGetByIdAsyncOnce()

await basketService.AddItemToBasket(basket.Id, 1, 1.50m);

_mockBasketRepo.Verify(x => x.FirstOrDefaultAsync(It.IsAny<BasketWithItemsSpecification>(),default), Times.Once);
_mockBasketRepo.Verify(x => x.FirstOrDefaultAsync(It.IsAny<BasketWithItemsSpecification>(), default), Times.Once);
}

[Fact]
public async Task InvokesBasketRepositoryUpdateAsyncOnce()
{
var basket = new Basket(_buyerId);
basket.AddItem(1, It.IsAny<decimal>(), It.IsAny<int>());
_mockBasketRepo.Setup(x => x.FirstOrDefaultAsync(It.IsAny<BasketWithItemsSpecification>(),default)).ReturnsAsync(basket);
_mockBasketRepo.Setup(x => x.FirstOrDefaultAsync(It.IsAny<BasketWithItemsSpecification>(), default)).ReturnsAsync(basket);

var basketService = new BasketService(_mockBasketRepo.Object, null);

await basketService.AddItemToBasket(basket.Id, 1, 1.50m);

_mockBasketRepo.Verify(x => x.UpdateAsync(basket,default), Times.Once);
_mockBasketRepo.Verify(x => x.UpdateAsync(basket, default), Times.Once);
}
}
}

0 comments on commit 97320e1

Please sign in to comment.