示例#1
0
 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);
     }
 }
示例#2
0
        public void ShouldPublishUpdatedAfterUpdatingPrices()
        {
            var eventAggregator = new MockPriceUpdatedEventAggregator();

            using (var marketFeed = new TestableMarketFeedService(eventAggregator))
            {
                marketFeed.InvokeUpdatePrices();
            }
            Assert.IsTrue(eventAggregator.MockMarketPriceUpdatedEvent.PublishCalled);
        }
示例#3
0
        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"]);
        }
        public void ShouldPublishUpdatedAfterUpdatingPrices()
        {
            var eventAggregator = new MockPriceUpdatedEventAggregator();

            using (var marketFeed = new TestableMarketFeedService(eventAggregator))
            {
                marketFeed.InvokeUpdatePrices();
            }
            Assert.IsTrue(eventAggregator.MockMarketPriceUpdatedEvent.PublishCalled);
        }
 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 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"]);
        }