Browse Source

Minor refactoring and Unit Test fix

pull/49/merge
CESARDELATORRE 8 years ago
parent
commit
fa6a273a33
3 changed files with 17 additions and 14 deletions
  1. +7
    -5
      src/Services/Ordering/Ordering.API/Startup.cs
  2. +8
    -8
      src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs
  3. +2
    -1
      test/Services/UnitTest/Ordering/Application/NewOrderCommandHandlerTest.cs

+ 7
- 5
src/Services/Ordering/Ordering.API/Startup.cs View File

@ -48,11 +48,13 @@
}).AddControllersAsServices();
services.AddEntityFrameworkSqlServer()
.AddDbContext<OrderingContext>(options =>
{
options.UseSqlServer(Configuration["ConnectionString"],
sqlop => sqlop.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name));
});
.AddDbContext<OrderingContext>(options =>
{
options.UseSqlServer(Configuration["ConnectionString"],
sqlop => sqlop.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name));
},
ServiceLifetime.Scoped
);
services.AddSwaggerGen();
services.ConfigureSwaggerGen(options =>


+ 8
- 8
src/Services/Ordering/Ordering.Infrastructure/Repositories/BuyerRepository.cs View File

@ -13,22 +13,22 @@
{
private readonly OrderingContext _context;
public BuyerRepository(OrderingContext context)
public IUnitOfWork UnitOfWork
{
if (context == null)
get
{
throw new ArgumentNullException(nameof(context));
return _context;
}
_context = context;
}
public IUnitOfWork UnitOfWork
public BuyerRepository(OrderingContext context)
{
get
if (context == null)
{
return _context;
throw new ArgumentNullException(nameof(context));
}
_context = context;
}
public Buyer Add(Buyer buyer)


+ 2
- 1
test/Services/UnitTest/Ordering/Application/NewOrderCommandHandlerTest.cs View File

@ -2,7 +2,8 @@
{
using Microsoft.eShopOnContainers.Services.Ordering.Api.Application.Commands;
using Microsoft.eShopOnContainers.Services.Ordering.Domain;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Repositories;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
using Moq;
using System;
using System.Threading;


Loading…
Cancel
Save