Example #1
0
 public MainViewModel(BuyerPortfolio portfolio)
 {
     StartBuyingCommand = new Command(Join);
     Buyers             = new ObservableCollection <BuyerViewModel>();
     _listeners         = new List <IUserRequestListener>();
     portfolio.AddPortfolioListener(this);
 }
        public void Notifies_listeners_of_new_buyers()
        {
            var sut  = new BuyerPortfolio();
            var mock = new Mock <IPortfolioListener>();

            sut.AddPortfolioListener(mock.Object);
            var buyer = new Buyer("ItemId", 10, 1, null);

            sut.AddBuyer(buyer);

            mock.Verify(x => x.BuyerAdded(buyer));
        }
Example #3
0
        public App()
        {
            var connection = new WarehouseConnection();
            var warehouse  = new Warehouse(connection, BuyerName);

            var portfolio     = new BuyerPortfolio();
            var launcher      = new BuyerLauncher(warehouse, portfolio);
            var mainViewModel = new MainViewModel(portfolio);

            mainViewModel.AddUserRequestListener(launcher);

            var window = new MainWindow
            {
                DataContext = mainViewModel
            };

            window.ShowDialog();
        }