Ejemplo n.º 1
0
        public void TestStopMonitoring_RemovesUpdatesForRemovedInstrument()
        {
            //Arrange
            myTestee.Start();
            myTestee.StartMonitoring(new List <string>()
            {
                "a"
            });
            myTestee.StartMonitoring(new List <string>()
            {
                "c"
            });

            //Act
            myTestee.StopMonitoring(new List <string>()
            {
                "c"
            });
            System.Threading.Thread.Sleep(myUpdateInterval);

            myReceivedInstrumentPrices = null;

            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
        }
Ejemplo n.º 2
0
        private void RemoveItem()
        {
            ErrorText = "";
            try
            {
                myPricingEngine.StopMonitoring(new List <string>()
                {
                    ItemToRemove.Symbol
                });
            }
            catch (InvalidDataException ex)
            {
                ErrorText = ex.Message;
            }

            ItemToRemove = null;
        }