Esempio n. 1
0
        public void Init()
        {
            var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>();

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

            applicationUser = new ApplicationUser
            {
                Id        = Guid.NewGuid(),
                IsEnabled = true,
                Type      = UserType.Manager,
                Wallets   = new List <Wallets> {
                    new Wallets {
                        Amount = 10000, Currency = Currency.GVT
                    }
                },
            };
            broker = new BrokersAccounts
            {
                Id               = Guid.NewGuid(),
                UserId           = applicationUser.Id,
                Description      = string.Empty,
                IsEnabled        = true,
                Name             = "Broker #1",
                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
            };
            managerAccount = new ManagerAccounts
            {
                Id = Guid.NewGuid(),
                BrokerTradeServerId = brokerTradeServer.Id,
                Currency            = Currency.USD,
                Login            = "******",
                RegistrationDate = DateTime.UtcNow,
                UserId           = applicationUser.Id,
                IsConfirmed      = true
            };

            context.Add(applicationUser);
            context.Add(broker);
            context.Add(brokerTradeServer);
            context.Add(managerAccount);
            context.SaveChanges();

            managerValidator = new ManagerValidator(context);
        }
Esempio n. 2
0
 public ManagerController(ITrustManagementService trustManagementService, IStatisticService statisticService, IManagerService managerService,
                          IManagerValidator managerValidator, UserManager <ApplicationUser> userManager, ILogger <ManagerController> logger)
     : base(userManager)
 {
     this.trustManagementService = trustManagementService;
     this.statisticService       = statisticService;
     this.managerService         = managerService;
     this.managerValidator       = managerValidator;
     this.logger = logger;
 }