Пример #1
0
 public TradesEmulator(
     IClientTableRepository clientTableRepository,
     ISharesTableRepository sharesTableRepository,
     ITransactionService transactionService)
 {
     this.clientTableRepository = clientTableRepository;
     this.sharesTableRepository = sharesTableRepository;
     this.transactionService    = transactionService;
 }
Пример #2
0
 public TransactionService(
     IClientTableRepository clientTableRepository,
     IClientSharesTableRepository clientSharesTableRepository,
     ISharesTableRepository sharesTableRepository,
     ITransactionHistoryTableRepository transactionHistoryTableRepository
     )
 {
     this.clientTableRepository             = clientTableRepository;
     this.clientSharesTableRepository       = clientSharesTableRepository;
     this.sharesTableRepository             = sharesTableRepository;
     this.transactionHistoryTableRepository = transactionHistoryTableRepository;
 }
 public TransactionServiceProxy(
     TransactionService transactionService,
     LoggerLog4Net logger,
     IClientTableRepository clientTableRepository,
     ISharesTableRepository sharesTableRepository)
 {
     this.transactionService    = transactionService;
     this.logger                = logger;
     this.clientTableRepository = clientTableRepository;
     this.sharesTableRepository = sharesTableRepository;
     logger.InitLogger();
 }
 public void Initialize()
 {
     clientTableRepository = Substitute.For <IClientTableRepository>();
     sharesTableRepository = Substitute.For <ISharesTableRepository>();
     clientTableRepository.GetById(1).Returns(new ClientEntity()
     {
         Id      = 1,
         Balance = 0M,
         Name    = "Vlad Blood"
     });
     clientTableRepository.GetAllInOrangeZone()
     .Returns(new List <ClientEntity>());
     clientTableRepository.GetAllInBlackZone()
     .Returns(new List <ClientEntity>());
     clientsService = new ClientsService(clientTableRepository, sharesTableRepository);
 }
Пример #5
0
 public TradingStart(
     IUserTableRepository userTableRepository,
     ISharesTableRepository sharesTableRepository,
     IAddingSharesToThUserServiceTableRepository addingSharesToThUserServiceTableRepository,
     ITransactionRepositories transactionRepositories,
     TradingSimulatorDbContext tradingSimulatorDbContext,
     UserService userService,
     SharesService sharesService,
     AddingSharesToThUserService addingSharesToThUserService,
     TransactionService transactionService,
     TradingSimulation tradingSimulation)
 {
     this.userTableRepository   = userTableRepository;
     this.sharesTableRepository = sharesTableRepository;
     this.addingSharesToThUserServiceTableRepository = addingSharesToThUserServiceTableRepository;
     this.transactionRepositories   = transactionRepositories;
     this.tradingSimulatorDbContext = tradingSimulatorDbContext;
     this.userService   = userService;
     this.sharesService = sharesService;
     this.addingSharesToThUserService = addingSharesToThUserService;
     this.transactionService          = transactionService;
     this.tradingSimulation           = tradingSimulation;
 }
Пример #6
0
 public SharesService(ISharesTableRepository sharesTableRepository)
 {
     this.sharesTableRepository = sharesTableRepository;
 }
Пример #7
0
 public AddingSharesToThUserService(IAddingSharesToThUserServiceTableRepository addingSharesToThUserServiceTableRepository, IUserTableRepository userTableRepository, ISharesTableRepository sharesTableRepository)
 {
     this.addingSharesToThUserServiceTableRepository = addingSharesToThUserServiceTableRepository;
     this.userTableRepository   = userTableRepository;
     this.sharesTableRepository = sharesTableRepository;
 }
Пример #8
0
        public void Initialize()
        {
            clientTableRepository             = Substitute.For <IClientTableRepository>();
            sharesTableRepository             = Substitute.For <ISharesTableRepository>();
            clientSharesTableRepository       = Substitute.For <IClientSharesTableRepository>();
            transactionHistoryTableRepository = Substitute.For <ITransactionHistoryTableRepository>();
            clientTableRepository.ContainsById(1).Returns(true);
            clientTableRepository.ContainsById(2).Returns(true);
            clientTableRepository.ContainsById(3).Returns(false);
            sharesTableRepository.ContainsById(1).Returns(true);
            sharesTableRepository.ContainsById(2).Returns(true);
            sharesTableRepository.ContainsById(3).Returns(true);
            sharesTableRepository.ContainsById(4).Returns(false);
            clientTableRepository.GetById(1).Returns(new ClientEntity()
            {
                Id        = 1,
                Balance   = 0M,
                Name      = "Seller",
                Portfolio = new List <ClientSharesEntity>()
                {
                    new ClientSharesEntity()
                    {
                        Id       = 1,
                        Quantity = 50,
                        Shares   = new SharesEntity
                        {
                            Id         = 1,
                            Price      = 10M,
                            SharesType = "TypeA"
                        }
                    },

                    new ClientSharesEntity()
                    {
                        Id       = 2,
                        Quantity = 10,
                        Shares   = new SharesEntity
                        {
                            Id         = 3,
                            Price      = 15M,
                            SharesType = "TypeC"
                        }
                    }
                }
            });
            clientTableRepository.GetById(2).Returns(new ClientEntity()
            {
                Id        = 2,
                Balance   = 100M,
                Name      = "Buyer",
                Portfolio = new List <ClientSharesEntity>()
                {
                    new ClientSharesEntity()
                    {
                        Id       = 2,
                        Quantity = 0,
                        Shares   = new SharesEntity
                        {
                            Id         = 2,
                            Price      = 5M,
                            SharesType = "TypeB"
                        }
                    },

                    new ClientSharesEntity()
                    {
                        Id       = 3,
                        Quantity = 15,
                        Shares   = new SharesEntity
                        {
                            Id         = 1,
                            Price      = 10M,
                            SharesType = "TypeA"
                        }
                    }
                }
            });
            sharesTableRepository.GetById(1).Returns(new SharesEntity()
            {
                Id         = 1,
                Price      = 10M,
                SharesType = "TypeA"
            });
            sharesTableRepository.GetById(2).Returns(new SharesEntity()
            {
                Id         = 2,
                Price      = 5M,
                SharesType = "TypeB"
            });
            sharesTableRepository.GetById(3).Returns(new SharesEntity()
            {
                Id         = 3,
                Price      = 15M,
                SharesType = "TypeC"
            });

            transactionService = new TransactionService(
                clientTableRepository,
                clientSharesTableRepository,
                sharesTableRepository,
                transactionHistoryTableRepository);
        }
Пример #9
0
 public void Initialize()
 {
     sharesTableRepository = Substitute.For <ISharesTableRepository>();
     sharesService         = new SharesService(sharesTableRepository);
 }
Пример #10
0
 public ClientsService(IClientTableRepository clientTableRepository, ISharesTableRepository sharesTableRepository)
 {
     this.clientTableRepository = clientTableRepository;
     this.sharesTableRepository = sharesTableRepository;
 }