예제 #1
0
        public void Change_Ask_Price_NOT_To_The_Best_Should_NOT_Publish_Event(decimal price)
        {
            //arrange
            PriceChanged priceChanged = null;

            SetupSubscribe <PriceChanged>((pc) => priceChanged = pc);
            var ask = NewAsk(units: 10, price: 99.99m);

            //act
            _matcher.Tell(ask);
            Thread.Sleep(500);

            //assert
            Assert.NotNull(priceChanged);
            Assert.Equal(99.99m, priceChanged.Ask);

            //arrange
            var ask2 = NewAsk(units: 10, price: price);

            //act
            _matcher.Tell(ask2);
            Thread.Sleep(500);

            //assert
            Assert.Equal(99.99m, priceChanged.Ask);
        }
예제 #2
0
        public void Change_Bid_Price_To_The_Best_Should_Publish_Event()
        {
            //arrange
            var          bid          = NewBid(units: 10, price: 99.98m);
            PriceChanged priceChanged = null;

            SetupSubscribe <PriceChanged>((pc) => priceChanged = pc);

            //act
            _matcher.Tell(bid);
            Thread.Sleep(500);

            //assert
            Assert.NotNull(priceChanged);
            Assert.Equal(99.98m, priceChanged.Bid);

            //arrange
            var bid2 = NewBid(units: 10, price: 99.99m);

            //act
            _matcher.Tell(bid2);
            Thread.Sleep(500);

            //assert
            Assert.Equal(99.99m, priceChanged.Bid);
        }
예제 #3
0
        public void Making_Trades_Affect_Best_Prices()
        {
            //arrange
            var          bid          = NewBid(units: 10, price: 99.98m);
            PriceChanged priceChanged = null;

            SetupSubscribe <PriceChanged>((pc) => priceChanged = pc);

            //act
            _matcher.Tell(bid);
            Thread.Sleep(500);

            //assert
            Assert.NotNull(priceChanged);
            Assert.Equal(99.98m, priceChanged.Bid);

            //arrange
            var bid2 = NewBid(units: 10, price: 99.99m);

            //act
            _matcher.Tell(bid2);
            Thread.Sleep(500);

            //assert
            Assert.Equal(99.99m, priceChanged.Bid);

            //arrange
            var ask = NewAsk(units: 10, price: 99.99m);

            //act
            _matcher.Tell(ask);
            Thread.Sleep(500);

            //assert
            Assert.Equal(99.98m, priceChanged.Bid);
            Assert.Null(priceChanged.Ask);
        }