Ejemplo n.º 1
0
 public BrokerController(IManagerService managerService, ITrustManagementService trustManagementService,
                         IBrokerValidator brokerValidator, UserManager <ApplicationUser> userManager, ITradesService tradesService, ILogger <BrokerController> logger)
     : base(userManager)
 {
     this.managerService         = managerService;
     this.trustManagementService = trustManagementService;
     this.tradesService          = tradesService;
     this.brokerValidator        = brokerValidator;
     this.logger = logger;
 }
Ejemplo n.º 2
0
        public void Init()
        {
            var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>();

            optionsBuilder.UseInMemoryDatabase("databaseBrokerValidator");
            context = new ApplicationDbContext(optionsBuilder.Options);

            user = new ApplicationUser
            {
                Id        = Guid.NewGuid(),
                IsEnabled = true,
                Type      = UserType.Broker
            };
            broker = new BrokersAccounts
            {
                Id               = Guid.NewGuid(),
                UserId           = user.Id,
                Description      = string.Empty,
                IsEnabled        = true,
                Name             = "Broker #1",
                Logo             = "logo.png",
                RegistrationDate = DateTime.UtcNow
            };
            brokerTradeServer = new BrokerTradeServers
            {
                Id               = Guid.NewGuid(),
                Name             = "Server #1",
                IsEnabled        = true,
                Host             = string.Empty,
                RegistrationDate = DateTime.UtcNow,
                Type             = BrokerTradeServerType.MetaTrader4,
                BrokerId         = broker.Id
            };
            context.Add(broker);
            context.Add(brokerTradeServer);
            context.SaveChanges();


            brokerValidator = new BrokerValidator(context);
        }