Ejemplo n.º 1
0
            public static async Task GetTransfersInProgressAsync_WalletAddressConditionCheck(
                IOperationsRepository repo,
                IOperationRequestsRepository requestsRepo,
                IQuorumOperationExecutorClient executorClient,
                string includeWalletAddress)
            {
                var rnd = new Random();

                var o = await repo.AddAsync(
                    Guid.NewGuid(),
                    FakeCustomerId,
                    1,
                    includeWalletAddress,
                    OperationType.TokensTransfer,
                    new TokensTransferContext
                {
                    SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next()
                }.ToJson(),
                    DateTime.UtcNow,
                    ValidTransactionHashes[0]);

                await repo.AddAsync(
                    Guid.NewGuid(),
                    FakeCustomerId,
                    2,
                    includeWalletAddress,
                    OperationType.TokensTransfer,
                    new TokensTransferContext
                {
                    SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next()
                }.ToJson(),
                    DateTime.UtcNow,
                    string.Empty);

                await repo.AddAsync(
                    Guid.NewGuid(),
                    FakeCustomerId,
                    3,
                    $"{includeWalletAddress}-{rnd.Next()}",
                    OperationType.CustomerWalletCreation,
                    new CustomerWalletContext { CustomerId = FakeCustomerId, WalletAddress = includeWalletAddress }
                    .ToJson(),
                    DateTime.UtcNow,
                    string.Empty);
            }
Ejemplo n.º 2
0
 public DetectedObjectController(
     IDetectedObjectRepository detectedObjectRepository,
     IOperationsRepository operationRepository,
     IMissionRepository missionRepository,
     IUserRepository userRepository,
     IHubContext <NotificationHub> notificationHub,
     IClusteringService clusteringService,
     IMapper mapper
     )
 {
     _detectedObjectRepository = detectedObjectRepository;
     _operationRepository      = operationRepository;
     _missionRepository        = missionRepository;
     _userRepository           = userRepository;
     _clusteringService        = clusteringService;
     _notificationHub          = notificationHub;
     _mapper = mapper;
 }
Ejemplo n.º 3
0
 public void Run(IOperationsRepository operationsRepository, Calculator calculator)
 {
     _generator  = operationsRepository;
     _operations = _generator.Generate();
     _calculator = calculator;
     foreach (var operation in _operations)
     {
         try
         {
             var result = calculator.Calculate(operation);
             Console.WriteLine(operation + " = " + result);
         }
         catch (ArgumentException e)
         {
             Console.WriteLine("ERROR: " + e.Message);
         }
     }
 }
 public OperationsService(
     IEthApiTransactionsService ethereumApi,
     IQuorumTransactionSignerClient transactionSigner,
     IOperationsRepository operationsRepository,
     INoncesRepository noncesRepository,
     ITransactionRunner transactionRunner,
     long gasLimit,
     long gasPrice,
     ILogFactory logFactory)
 {
     _ethereumApi          = ethereumApi;
     _transactionSigner    = transactionSigner;
     _operationsRepository = operationsRepository;
     _noncesRepository     = noncesRepository;
     _transactionRunner    = transactionRunner;
     _gasLimit             = gasLimit;
     _gasPrice             = gasPrice;
     _log = logFactory.CreateLog(this);
 }
Ejemplo n.º 5
0
 public OperationsController(IOperationsRepository operationsRepository)
 {
     _operationsRepository = operationsRepository;
 }
 public StartSaleProcessCommandHandler(DataContext context, IUserAccessor userAccessor, IOperationsRepository operationsRepository)
 {
     _userAccessor = userAccessor;
     _operationsRepository = operationsRepository;
     _context = context;
 }
Ejemplo n.º 7
0
            public static async Task GetTransfersInProgressAsync_OperationStatusConditionCheck(
                IOperationsRepository repo,
                IOperationRequestsRepository requestsRepo,
                IQuorumOperationExecutorClient executorClient)
            {
                var rnd = new Random();

                var statusUpdater = new OperationStatusUpdater(
                    EmptyLogFactory.Instance,
                    new TransactionScopeHandler(EmptyLogFactory.Instance),
                    repo,
                    executorClient,
                    requestsRepo);

                var o1 = await repo.AddAsync(
                    Guid.NewGuid(),
                    FakeCustomerId,
                    1,
                    FakeWalletAddress,
                    OperationType.TokensTransfer,
                    new TokensTransferContext
                {
                    SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next()
                }.ToJson(),
                    DateTime.UtcNow,
                    ValidTransactionHashes[0]);

                var o2 = await repo.AddAsync(
                    Guid.NewGuid(),
                    FakeCustomerId,
                    2,
                    FakeWalletAddress,
                    OperationType.TokensTransfer,
                    new TokensTransferContext
                {
                    SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next()
                }.ToJson(),
                    DateTime.UtcNow,
                    ValidTransactionHashes[1]);

                var o3 = await repo.AddAsync(
                    Guid.NewGuid(),
                    FakeCustomerId,
                    3,
                    FakeWalletAddress,
                    OperationType.TokensTransfer,
                    new TokensTransferContext
                {
                    SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next()
                }.ToJson(),
                    DateTime.UtcNow,
                    ValidTransactionHashes[2]);

                await statusUpdater.SucceedAsync(ValidTransactionHashes[2]);

                var o4 = await repo.AddAsync(
                    Guid.NewGuid(),
                    FakeCustomerId,
                    4,
                    FakeWalletAddress,
                    OperationType.TokensTransfer,
                    new TokensTransferContext
                {
                    SenderWalletAddress = FakeWalletAddress, RecipientWalletAddress = FakeWalletAddress, Amount = rnd.Next()
                }.ToJson(),
                    DateTime.UtcNow,
                    ValidTransactionHashes[3]);

                await statusUpdater.FailAsync(ValidTransactionHashes[3]);

                var o5 = await repo.AddAsync(
                    Guid.NewGuid(),
                    FakeCustomerId,
                    5,
                    FakeWalletAddress,
                    OperationType.CustomerWalletCreation,
                    new CustomerWalletContext { CustomerId = FakeCustomerId, WalletAddress = FakeWalletAddress }.ToJson(),
                    DateTime.UtcNow,
                    ValidTransactionHashes[4]);

                await statusUpdater.AcceptAsync(o5, ValidTransactionHashes[4]);

                var o6 = await repo.AddAsync(
                    Guid.NewGuid(),
                    FakeCustomerId,
                    6,
                    FakeWalletAddress,
                    OperationType.CustomerWalletCreation,
                    new CustomerWalletContext { CustomerId = FakeCustomerId, WalletAddress = FakeWalletAddress }.ToJson(),
                    DateTime.UtcNow,
                    ValidTransactionHashes[5]);
            }
 public MachineTypeController(IMachineTypeRepository IMachineTypeRepository, IOperationsRepository IOperationsRepository)
 {
     _IMachineTypeRepository = IMachineTypeRepository;
     _IOperationsRepository  = IOperationsRepository;
 }
Ejemplo n.º 9
0
 public AddLeadCommandHandler(DataContext context, IOperationsRepository operationsRepository)
 {
     _operationsRepository = operationsRepository;
     _context = context;
 }
Ejemplo n.º 10
0
 public ResourcesService(IResourcesRepository repository, ICyclicOperationRepository cyclicOperationRepository, IOperationsRepository operationRepository, IMapper mapper)
 {
     _repository = repository ?? throw new ArgumentNullException(nameof(repository));
     _cyclicOperationRepository = cyclicOperationRepository ?? throw new ArgumentNullException(nameof(cyclicOperationRepository));
     _operationRepository       = operationRepository ?? throw new ArgumentNullException(nameof(operationRepository));
     _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
 /// <summary>
 /// Creates a new <see cref="OperationsStatusTasks"/>.
 /// </summary>
 /// <param name="operationRepository">Storage.</param>
 public OperationsStatusTasks(IOperationsRepository operationRepository)
 {
     this.operationRepository = operationRepository;
 }
 public DeleteOrderCommandHandler(DataContext context, IOperationsRepository operationsRepository)
 {
     _operationsRepository = operationsRepository;
     _context = context;
 }
Ejemplo n.º 13
0
 public OperationsManager(ICacheProvider cacheProvider, IOperationsRepository operationsRepository)
 {
     _cacheProvider        = cacheProvider;
     _operationsRepository = operationsRepository;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Creates a new <see cref="OperationsControlTasks"/>.
 /// </summary>
 /// <param name="operationRepository">Storage.</param>
 public OperationsControlTasks(IOperationsRepository operationRepository)
 {
     this.operationRepository = operationRepository;
 }
Ejemplo n.º 15
0
 public CalculatorTrainer(IOperationsRepository operations)
 {
     _operations = operations;
 }
Ejemplo n.º 16
0
 public OperationsService(IOperationsRepository repository, IMapper mapper)
 {
     _repository = repository ?? throw new ArgumentNullException(nameof(repository));
     _mapper     = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
 public AddOrderCommandHandler(DataContext context, IUserAccessor userAccessor, IOperationsRepository operationsRepository)
 {
     _operationsRepository = operationsRepository;
     _userAccessor         = userAccessor;
     _context = context;
 }
 public ChangeStatusCommandHandler(DataContext context, IUserAccessor userAccessor, IOperationsRepository operationsRepository)
 {
     _operationsRepository = operationsRepository;
     _context      = context;
     _userAccessor = userAccessor;
 }
Ejemplo n.º 19
0
 public ItemsService(IItemsRepository itemsRepository, IOperationsRepository operationsRepository)
 {
     _itemsRepository      = itemsRepository;
     _operationsRepository = operationsRepository;
 }
Ejemplo n.º 20
0
 public OperationsWriter(Notificator <TEntity> notificator, IOperationsRepository <TOperation, TEntity> operationsRepository)
 {
     _notificator          = notificator;
     _operationsRepository = operationsRepository;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperationsService" /> class.
 /// </summary>
 /// <param name="operationRepository">Operation repository. </param>
 public OperationsService(IOperationsRepository operationRepository)
 {
     _operationsRepository = operationRepository;
 }