Update Specification and other packages to latest version (#582)
* Updating repositories and specification version Need to fix broken tests * removing test that would just be testing mocked result now * Refactored from IAsyncRepository and removed it. Tests pass. * Update packages
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
|
||||
using Microsoft.eShopWeb.Infrastructure.Data;
|
||||
using Microsoft.eShopWeb.UnitTests.Builders;
|
||||
using System.Linq;
|
||||
@@ -11,7 +12,7 @@ namespace Microsoft.eShopWeb.IntegrationTests.Repositories.OrderRepositoryTests
|
||||
public class GetById
|
||||
{
|
||||
private readonly CatalogContext _catalogContext;
|
||||
private readonly OrderRepository _orderRepository;
|
||||
private readonly EfRepository<Order> _orderRepository;
|
||||
private OrderBuilder OrderBuilder { get; } = new OrderBuilder();
|
||||
private readonly ITestOutputHelper _output;
|
||||
public GetById(ITestOutputHelper output)
|
||||
@@ -21,7 +22,7 @@ namespace Microsoft.eShopWeb.IntegrationTests.Repositories.OrderRepositoryTests
|
||||
.UseInMemoryDatabase(databaseName: "TestCatalog")
|
||||
.Options;
|
||||
_catalogContext = new CatalogContext(dbOptions);
|
||||
_orderRepository = new OrderRepository(_catalogContext);
|
||||
_orderRepository = new EfRepository<Order>(_catalogContext);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -37,6 +38,7 @@ namespace Microsoft.eShopWeb.IntegrationTests.Repositories.OrderRepositoryTests
|
||||
Assert.Equal(OrderBuilder.TestBuyerId, orderFromRepo.BuyerId);
|
||||
|
||||
// Note: Using InMemoryDatabase OrderItems is available. Will be null if using SQL DB.
|
||||
// Use the OrderWithItemsByIdSpec instead of just GetById to get the full aggregate
|
||||
var firstItem = orderFromRepo.OrderItems.FirstOrDefault();
|
||||
Assert.Equal(OrderBuilder.TestUnits, firstItem.Units);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user