Пример #1
0
 public ServiceManager(IEnumerable <IExchangeService> exchangeServices, JobService jobService, CandleService candleService, OrderService orderService)
 {
     _exchangeServices = exchangeServices;
     _jobService       = jobService;
     _candleService    = candleService;
     _orderService     = orderService;
 }
Пример #2
0
        public TraderService(ILogger logger, CandleService candleService, IEnumerable <ISignal> signals)
        {
            _logger        = logger;
            _candleService = candleService;

            _signals = signals.ToDictionary(x => x.GetType());
        }
Пример #3
0
        public SignalsService(ILogger logger, RepositoryService repositoryService, CandleService candleService, IEnumerable <ISignal> signals)
        {
            _logger            = logger;
            _repositoryService = repositoryService;
            _candleService     = candleService;

            _signals = signals.ToDictionary(x => x.GetType().Name);
        }
Пример #4
0
        public void DeleteCandleShouldBeCalledOnce()
        {
            var candleRepo = new Mock <ICandleRepository>();

            candleRepo.Setup(cr => cr.DeleteCandle(1));

            ICandleService service = new CandleService(candleRepo.Object);

            service.DeleteCandle(1);
            candleRepo.Verify(cr => cr.DeleteCandle(1), Times.Once);
        }
Пример #5
0
        public void CreateCandleShouldCallCandleRepositoryCreateCandleOnce()
        {
            var candleRepo = new Mock <ICandleRepository>();

            //Magic
            candleRepo.Setup(cr => cr.CandleFoundById(It.IsAny <int>())).Returns(new Candle()
            {
                id = 1
            });

            ICandleService service = new CandleService(candleRepo.Object);

            var candle = new Candle()
            {
                name     = "Candle",
                price    = 10.0,
                stock    = 3,
                type     = "Wax",
                imageURL = "Something"
            };

            service.CreateCandle(candle);
            candleRepo.Verify(cr => cr.CreateCandle(It.IsAny <Candle>()), Times.Once);
        }
Пример #6
0
        public void CreateCandleNameMissingThrowsException()
        {
            var candleRepo = new Mock <ICandleRepository>();

            //Magic
            candleRepo.Setup(cr => cr.CandleFoundById(It.IsAny <int>())).Returns(new Candle()
            {
                id = 1
            });

            ICandleService service = new CandleService(candleRepo.Object);

            var candle = new Candle()
            {
                price    = 10.0,
                stock    = 3,
                type     = "Wax",
                imageURL = "Something"
            };

            Exception ex = Assert.Throws <InvalidDataException>(() => service.CreateCandle(candle));

            Assert.Equal("Candle needs a name", ex.Message);
        }
Пример #7
0
 public void AddSubscription(CandleService Route)
 {
     this.Queue.OnAddHandler += Route.Queue_OnAddHandler;
 }