コード例 #1
0
        public void ReturnsSameAsReference()
        {
            var randomMock = new Mock <IRandomValueGenerator>();

            randomMock.Setup(s => s.NextPrice(It.IsAny <SecurityType>(), It.IsNotNull <string>(), It.IsAny <decimal>(),
                                              It.IsAny <decimal>()))
            .Returns(50);
            var randomPriceGenerator = new RandomPriceGenerator(_security, randomMock.Object);

            _security.SetMarketPrice(new Tick(DateTime.UtcNow, Symbols.SPY, 10, 100));

            var actual = randomPriceGenerator.NextValue(1, DateTime.MinValue);

            randomMock.Verify(s => s.NextPrice(It.IsAny <SecurityType>(), It.IsNotNull <string>(), 55, 1), Times.Once);
            Assert.AreEqual(50, actual);
        }
コード例 #2
0
        public void AlwaysReady()
        {
            var priceGenerator = new RandomPriceGenerator(_security, Mock.Of <IRandomValueGenerator>());

            Assert.True(priceGenerator.WarmedUp);
        }