public void PriceAndPublishEverything(IProvideMarketData marketDataProvider, IPublishPrice pricePublisher) { var underlyings = Perimeter.GetPerimeter(_allUnderlyingsProvider); var pricingTask = new PricingTask(marketDataProvider, pricePublisher); foreach (var underlying in underlyings) { pricingTask.PriceAndPublish(underlying); } }
public void Can_price_and_publish() { var marketDataProvider = NSubstitute.Substitute.For <IProvideMarketData>(); marketDataProvider.GetClose(Arg.Any <string>()).Returns(1); IPublishPrice pricePublisher = Substitute.For <IPublishPrice>(); var allUnderlyings = Substitute.For <AllUnderlyings>(); var products = new[] { "Cacao", "Sucre", "Petrole", "Carcasses de porc", "Or", "Cuivre" }.Where(x => x.StartsWith("C")); allUnderlyings.GetAllProducts().Returns(products); var massPricerPublisher = new MassPricerPublisher(allUnderlyings); massPricerPublisher.PriceAndPublishEverything(marketDataProvider, pricePublisher); pricePublisher.Received(products.Count()).Publish(3); }
public PricingTask(IProvideMarketData marketDataProvider, IPublishPrice pricePublisherAdapter) { _marketDataProvider = marketDataProvider; _pricePublisherAdapter = pricePublisherAdapter; }