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:
Shady Nagy
2021-11-06 01:55:48 +02:00
committed by GitHub
parent 64f150dc07
commit 9db2feb930
252 changed files with 6307 additions and 6413 deletions

View File

@@ -1,46 +1,45 @@
using Microsoft.EntityFrameworkCore;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
using Microsoft.eShopWeb.Infrastructure.Data;
using Microsoft.eShopWeb.UnitTests.Builders;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.eShopWeb.IntegrationTests.Repositories.OrderRepositoryTests
namespace Microsoft.eShopWeb.IntegrationTests.Repositories.OrderRepositoryTests;
public class GetById
{
public class GetById
private readonly CatalogContext _catalogContext;
private readonly EfRepository<Order> _orderRepository;
private OrderBuilder OrderBuilder { get; } = new OrderBuilder();
private readonly ITestOutputHelper _output;
public GetById(ITestOutputHelper output)
{
private readonly CatalogContext _catalogContext;
private readonly EfRepository<Order> _orderRepository;
private OrderBuilder OrderBuilder { get; } = new OrderBuilder();
private readonly ITestOutputHelper _output;
public GetById(ITestOutputHelper output)
{
_output = output;
var dbOptions = new DbContextOptionsBuilder<CatalogContext>()
.UseInMemoryDatabase(databaseName: "TestCatalog")
.Options;
_catalogContext = new CatalogContext(dbOptions);
_orderRepository = new EfRepository<Order>(_catalogContext);
}
_output = output;
var dbOptions = new DbContextOptionsBuilder<CatalogContext>()
.UseInMemoryDatabase(databaseName: "TestCatalog")
.Options;
_catalogContext = new CatalogContext(dbOptions);
_orderRepository = new EfRepository<Order>(_catalogContext);
}
[Fact]
public async Task GetsExistingOrder()
{
var existingOrder = OrderBuilder.WithDefaultValues();
_catalogContext.Orders.Add(existingOrder);
_catalogContext.SaveChanges();
int orderId = existingOrder.Id;
_output.WriteLine($"OrderId: {orderId}");
[Fact]
public async Task GetsExistingOrder()
{
var existingOrder = OrderBuilder.WithDefaultValues();
_catalogContext.Orders.Add(existingOrder);
_catalogContext.SaveChanges();
int orderId = existingOrder.Id;
_output.WriteLine($"OrderId: {orderId}");
var orderFromRepo = await _orderRepository.GetByIdAsync(orderId);
Assert.Equal(OrderBuilder.TestBuyerId, orderFromRepo.BuyerId);
var orderFromRepo = await _orderRepository.GetByIdAsync(orderId);
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);
}
// 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);
}
}