Exemple #1
0
 public SpotService(DataGenerationSettings settings)
 {
     _settings = settings;
     _symbols  = Enum.GetValues(typeof(Symbol)).Cast <Symbol>().ToList().AsReadOnly();
     _prices   = _symbols.ToDictionary(symbol => symbol, symbol => 0m);
     LoadPrices();
 }
Exemple #2
0
 public Timer(DataGenerationSettings settings, ILoggerFactory loggerFactory,
              Action handler)
 {
     _settings = settings;
     _handler  = handler;
     _logger   = loggerFactory.CreateLogger <Timer>();
 }
Exemple #3
0
 public PositionService(SpotService spotService, ITimerFactory timerFactory, DataGenerationSettings settings,
                        IHubContext <UpdateHub> updateHub)
 {
     _spotService = spotService;
     _settings    = settings;
     _updateHub   = updateHub;
     _timer       = timerFactory.Create(UpdatePositions);
 }
Exemple #4
0
        public void Setup()
        {
            var timerFactoryMock = new Mock <ITimerFactory>();

            timerFactoryMock.Setup(factory => factory.Create(It.IsAny <Action>()))
            .Returns(new Mock <ITimer>().Object)
            .Callback <Action>(handler => _handler = handler);
            _settings = new DataGenerationSettings();

            _clientProxyMock = new Mock <IClientProxy>();
            var hubClients = new Mock <IHubClients>();

            hubClients.Setup(clients => clients.All).Returns(_clientProxyMock.Object);
            var hubMock = new Mock <IHubContext <UpdateHub> >();

            hubMock.Setup(hub => hub.Clients)
            .Returns(hubClients.Object);
            _service = new PositionService(new SpotService(_settings), timerFactoryMock.Object, _settings,
                                           hubMock.Object);
        }
Exemple #5
0
 public void SetUp()
 {
     _settings = new DataGenerationSettings();
     _service  = new SpotService(_settings);
 }
Exemple #6
0
 public TimerFactory(DataGenerationSettings settings,
                     ILoggerFactory loggerFactory)
 {
     _settings      = settings;
     _loggerFactory = loggerFactory;
 }