Shady nagy/net6 (#614)
* udated to .net6 * used the .net6 version RC2 * added editconfig. * App core new Scoped Namespaces style. * BlazorAdmin new Scoped Namespaces style. * Blazor Shared new Scoped Namespaces style. * Infra new Scoped Namespaces style. * public api new Scoped Namespaces style. * web new Scoped Namespaces style. * FunctionalTests new Scoped Namespaces style. * Integrational tests new Scoped Namespaces style. * unit tests new Scoped Namespaces style. * update github action. * update github action. * change the global.
This commit is contained in:
@@ -1,41 +1,40 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Entities.BasketAggregate;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Services;
|
||||
using Microsoft.eShopWeb.Infrastructure.Data;
|
||||
using Microsoft.eShopWeb.UnitTests.Builders;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.eShopWeb.IntegrationTests.Repositories.BasketRepositoryTests
|
||||
namespace Microsoft.eShopWeb.IntegrationTests.Repositories.BasketRepositoryTests;
|
||||
|
||||
public class SetQuantities
|
||||
{
|
||||
public class SetQuantities
|
||||
private readonly CatalogContext _catalogContext;
|
||||
private readonly EfRepository<Basket> _basketRepository;
|
||||
private readonly BasketBuilder BasketBuilder = new BasketBuilder();
|
||||
|
||||
public SetQuantities()
|
||||
{
|
||||
private readonly CatalogContext _catalogContext;
|
||||
private readonly EfRepository<Basket> _basketRepository;
|
||||
private readonly BasketBuilder BasketBuilder = new BasketBuilder();
|
||||
var dbOptions = new DbContextOptionsBuilder<CatalogContext>()
|
||||
.UseInMemoryDatabase(databaseName: "TestCatalog")
|
||||
.Options;
|
||||
_catalogContext = new CatalogContext(dbOptions);
|
||||
_basketRepository = new EfRepository<Basket>(_catalogContext);
|
||||
}
|
||||
|
||||
public SetQuantities()
|
||||
{
|
||||
var dbOptions = new DbContextOptionsBuilder<CatalogContext>()
|
||||
.UseInMemoryDatabase(databaseName: "TestCatalog")
|
||||
.Options;
|
||||
_catalogContext = new CatalogContext(dbOptions);
|
||||
_basketRepository = new EfRepository<Basket>(_catalogContext);
|
||||
}
|
||||
[Fact]
|
||||
public async Task RemoveEmptyQuantities()
|
||||
{
|
||||
var basket = BasketBuilder.WithOneBasketItem();
|
||||
var basketService = new BasketService(_basketRepository, null);
|
||||
await _basketRepository.AddAsync(basket);
|
||||
_catalogContext.SaveChanges();
|
||||
|
||||
[Fact]
|
||||
public async Task RemoveEmptyQuantities()
|
||||
{
|
||||
var basket = BasketBuilder.WithOneBasketItem();
|
||||
var basketService = new BasketService(_basketRepository, null);
|
||||
await _basketRepository.AddAsync(basket);
|
||||
_catalogContext.SaveChanges();
|
||||
await basketService.SetQuantities(BasketBuilder.BasketId, new Dictionary<string, int>() { { BasketBuilder.BasketId.ToString(), 0 } });
|
||||
|
||||
await basketService.SetQuantities(BasketBuilder.BasketId, new Dictionary<string, int>() { { BasketBuilder.BasketId.ToString(), 0 } });
|
||||
|
||||
Assert.Equal(0, basket.Items.Count);
|
||||
}
|
||||
Assert.Equal(0, basket.Items.Count);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user