예제 #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;
 }
예제 #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;
 }
예제 #3
0
 public InvestorController(ITrustManagementService trustManagementService, IUserService userService, IInvestorValidator investorValidator, UserManager <ApplicationUser> userManager, IStatisticService statisticService, ITradesService tradesService, IWalletService walletService, ILogger <InvestorController> logger)
     : base(userManager)
 {
     this.trustManagementService = trustManagementService;
     this.investorValidator      = investorValidator;
     this.userService            = userService;
     this.statisticService       = statisticService;
     this.tradesService          = tradesService;
     this.walletService          = walletService;
     this.logger = logger;
 }
예제 #4
0
        public void Init()
        {
            var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>();

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

            user = new ApplicationUser
            {
                Id        = Guid.NewGuid(),
                IsEnabled = true,
                Wallets   = new List <Wallets> {
                    new Wallets {
                        Amount = 100000, Currency = Currency.GVT
                    }
                },
            };
            managerAccount = new ManagerAccounts
            {
                Id          = Guid.NewGuid(),
                IsConfirmed = true,
                UserId      = user.Id
            };
            investmentProgram = new InvestmentPrograms
            {
                Id               = Guid.NewGuid(),
                DateFrom         = DateTime.UtcNow.AddYears(-1),
                FeeEntrance      = 100m,
                FeeSuccess       = 120m,
                FeeManagement    = 10m,
                Description      = "Test inv",
                IsEnabled        = true,
                Period           = 10,
                InvestMinAmount  = 500,
                InvestMaxAmount  = 1500,
                ManagerAccountId = managerAccount.Id,
                Token            = new ManagerTokens
                {
                    TokenName   = "Token",
                    TokenSymbol = "TST"
                }
            };
            broker = new BrokersAccounts
            {
                Id               = Guid.NewGuid(),
                UserId           = user.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
            };
            context.Add(user);
            context.Add(managerAccount);
            context.Add(investmentProgram);
            context.Add(broker);
            context.Add(brokerTradeServer);
            context.SaveChanges();

            smartContractService = new Mock <ISmartContractService>();
            ipfsService          = new Mock <IIpfsService>();
            statisticService     = new Mock <IStatisticService>();
            rateService          = new Mock <IRateService>();

            trustManagementService = new TrustManagementService(context,
                                                                ipfsService.Object,
                                                                smartContractService.Object,
                                                                statisticService.Object,
                                                                rateService.Object,
                                                                Substitute.For <ILogger <ITrustManagementService> >());
        }