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)); }
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(); }