public SpotService(DataGenerationSettings settings) { _settings = settings; _symbols = Enum.GetValues(typeof(Symbol)).Cast <Symbol>().ToList().AsReadOnly(); _prices = _symbols.ToDictionary(symbol => symbol, symbol => 0m); LoadPrices(); }
public Timer(DataGenerationSettings settings, ILoggerFactory loggerFactory, Action handler) { _settings = settings; _handler = handler; _logger = loggerFactory.CreateLogger <Timer>(); }
public PositionService(SpotService spotService, ITimerFactory timerFactory, DataGenerationSettings settings, IHubContext <UpdateHub> updateHub) { _spotService = spotService; _settings = settings; _updateHub = updateHub; _timer = timerFactory.Create(UpdatePositions); }
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); }
public void SetUp() { _settings = new DataGenerationSettings(); _service = new SpotService(_settings); }
public TimerFactory(DataGenerationSettings settings, ILoggerFactory loggerFactory) { _settings = settings; _loggerFactory = loggerFactory; }