Exemplo n.º 1
0
        public void TestStartMonitoring_ReceivesPriceNotifications()
        {
            //Arrange
            myTestee.Start();

            //Act
            myTestee.StartMonitoring(new List <string>()
            {
                "a"
            });
            System.Threading.Thread.Sleep(myUpdateInterval * 3);

            //Assert
            Assert.NotNull(myReceivedInstrumentPrices);
            Assert.IsTrue(myReceivedInstrumentPrices.ToList().ToDictionary(x => x.Key, x => x.Value).ContainsKey("a"));
            Assert.AreEqual(1, myReceivedInstrumentPrices.ToList().Count); //Should contain only one item
        }
Exemplo n.º 2
0
        private void AddItem()
        {
            if (!CurrentInstrumentItems.Any(item => item.Symbol == ItemToAdd.ToUpper()))
            {
                ErrorText = "";

                try
                {
                    myPricingEngine.StartMonitoring(new List <string>()
                    {
                        ItemToAdd.ToUpper()
                    });
                }
                catch (InvalidDataException ex)
                {
                    ErrorText = ex.Message;
                }
            }
            else
            {
                ErrorText = string.Format(" {0} already in the list!", ItemToAdd);
            }
        }