public void ShouldUpdatePricesWithin5Points() { using (var marketFeed = new TestableMarketFeedService(new MockPriceUpdatedEventAggregator())) { decimal originalPrice = marketFeed.GetPrice("STOCK0"); marketFeed.InvokeUpdatePrices(); Assert.IsTrue(Math.Abs(marketFeed.GetPrice("STOCK0") - originalPrice) <= 5); } }
public void CanGetPriceAndVolumeFromMarketFeed() { using (var marketFeed = new TestableMarketFeedService(new MockPriceUpdatedEventAggregator())) { marketFeed.TestUpdatePrice("STOCK0", 40.00m, 1234); Assert.AreEqual <decimal>(40.00m, marketFeed.GetPrice("STOCK0")); Assert.AreEqual <long>(1234, marketFeed.GetVolume("STOCK0")); } }
public void CanGetPriceAndVolumeFromMarketFeed() { using (var marketFeed = new TestableMarketFeedService(new MockPriceUpdatedEventAggregator())) { marketFeed.TestUpdatePrice("STOCK0", 40.00m, 1234); Assert.AreEqual<decimal>(40.00m, marketFeed.GetPrice("STOCK0")); Assert.AreEqual<long>(1234, marketFeed.GetVolume("STOCK0")); } }
public void PublishedEventContainsTheUpdatedPriceList() { var eventAgregator = new MockPriceUpdatedEventAggregator(); var marketFeed = new TestableMarketFeedService(eventAgregator); Assert.IsTrue(marketFeed.SymbolExists("STOCK0")); marketFeed.InvokeUpdatePrices(); Assert.IsTrue(eventAgregator.MockMarketPriceUpdatedEvent.PublishCalled); var payload = eventAgregator.MockMarketPriceUpdatedEvent.PublishArgumentPayload; Assert.IsNotNull(payload); Assert.IsTrue(payload.ContainsKey("STOCK0")); Assert.AreEqual(marketFeed.GetPrice("STOCK0"), payload["STOCK0"]); }