public OrderServiceTest()
        {
            //var sqlConnectionStringBuilder = new SqlConnectionStringBuilder
            //{
            //    DataSource = "(local)",
            //    InitialCatalog = "GameId",
            //    UserID = "sa",
            //    Password = "******"
            //};

            var mockSecurityService = new Mock <ISecurityService>();

            mockSecurityService.Setup(foo => foo.IsExistsBlackList("us001")).Returns(false);

            var serviceProvider = new ServiceCollection()
                                  .AddLogging()
                                  .AddHttpClient()
                                  .AddMediatR()
                                  .AddScoped <IBizofferAppService, BizofferAppService>()
                                  .AddScoped <IBizofferRepository, BizofferRepository>()
                                  .AddScoped <IOrderAppService, OrderAppService>()
                                  .AddScoped <IPlaceOrderService, PlaceOrderService>()
                                  .AddScoped <IBizofferService, BizofferServiceClient>()
                                  .AddScoped <ISellerRepository, SellerRepository>()
                                  //.AddScoped<ISecurityService,SecurityServiceClient>()
                                  .AddScoped(typeof(ISecurityService), sp => mockSecurityService.Object)
                                  .AddScoped <IOrderRepository, OrderRepository>()
                                  .AddScoped <IUnitOfWork, UnitOfWork>()
                                  .AddDbContext <GameId.Infrastructure.AppContext>(options =>
            {
                //options.UseSqlServer(sqlConnectionStringBuilder.ConnectionString);
            })
                                  .BuildServiceProvider();

            orderAppService   = serviceProvider.GetService <IOrderAppService>();
            placeOrderService = serviceProvider.GetService <IPlaceOrderService>();
        }
 public OrderAppService(IOrderRepository orderRepository, IPlaceOrderService placeOrderService, IUnitOfWork unitOfWork)
 {
     this.orderRepository   = orderRepository;
     this.placeOrderService = placeOrderService;
     this.unitOfWork        = unitOfWork;
 }
 public PlaceOrderController(IPlaceOrderService placeOrderService)
 {
     this.placeOrderService = placeOrderService;
 }
Esempio n. 4
0
 public PlaceOrderController(IPlaceOrderService placeOrder)
 {
     this._placeOrder = placeOrder;
 }