public void WhenStockSymbolSet_PropertyIsUpdated()
        {
            // Prepare
            string stockSymbol = "StockSymbol";

            Mock<IWatchListService> mockWatchListService = new Mock<IWatchListService>();

            IWatchListService watchListService = mockWatchListService.Object;

            AddWatchViewModel target = new AddWatchViewModel(watchListService);

            bool propertyChangedRaised = false;
            target.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "StockSymbol")
                {
                    propertyChangedRaised = true;
                }
            };

            // Act
            target.StockSymbol = stockSymbol;

            // Verify
            Assert.AreEqual(stockSymbol, target.StockSymbol);
            Assert.IsTrue(propertyChangedRaised);
        }
        public void WhenConstructedWithNullWatchListService_Throws()
        {
            // Prepare
            IWatchListService watchListService = null;

            // Act
            AddWatchViewModel actual = new AddWatchViewModel(watchListService);
            
            // Verify
        }
        public void WhenConstructed_IntializesValues()
        {
            // Prepare
            ICommand addWatchCommand = new DelegateCommand(() => {});

            Mock<IWatchListService> mockWatchListService = new Mock<IWatchListService>();
            mockWatchListService.SetupGet(x => x.AddWatchCommand).Returns(addWatchCommand);

            IWatchListService watchListService = mockWatchListService.Object;

            // Act
            AddWatchViewModel actual = new AddWatchViewModel(watchListService);

            // Verify
            Assert.IsNotNull(actual);
            Assert.AreEqual(addWatchCommand, actual.AddWatchCommand);
        }
Exemple #4
0
 public AddWatchView(AddWatchViewModel viewModel)
 {
     InitializeComponent();
     ViewModel = viewModel;
 }