public HomeScreenViewModel(IpmModel ipmModel, IRegionManager regionManager) { this.ipmModel = ipmModel; this.regionManager = regionManager; this.StartCreatingPortfolioCommand = new DelegateCommand(this.ExecuteStartCreatingPortfolio); this.CancelPortfolioCreationCommand = new DelegateCommand(this.ExecuteCancelPortfolioCreation); this.CreatePortfolioCommand = new DelegateCommand(this.ExecuteCreatePortfolio); this.OpenPortfolioCommand = new DelegateCommand <Portfolio>(this.ExecuteOpenPortfolio); }
public void CreateBuyTransactions() { var portfolio = new Portfolio { Name = "Test Portfolio" }; var account = new Account { Name = "TD TFSA", Description = "TD TFSA Account CAD", Currency = "CAD", }; portfolio.Accounts.Add(account); this.model.Portfolios.Add(portfolio); this.model.SaveChanges(); var date = DateTime.Now; const decimal Price = (decimal)23.02; const decimal Quantity = (decimal)1000; const decimal Amount = (Price * Quantity) + (decimal)9.99; var cashTransaction = new CashTransaction { TransactionDate = date, Description = "Buying 1000 x $23.02 MSFT shares.", Comment = "Great deal", Amount = -Amount }; var transaction = new AssetTransaction { TransactionDate = DateTime.Now, TickerSymbol = "MSFT", Description = "Microsoft Corporation", Price = Price, Quantity = Quantity, Commission = (decimal)9.95, Amount = Amount }; account.CashTransactions.Add(cashTransaction); account.AssetTransactions.Add(transaction); this.model.SaveChanges(); using (var vmodel = new IpmModel()) { Assert.IsNotNull(vmodel); var pf = this.model.Portfolios.Find(portfolio.PortfolioId); Assert.IsNotNull(pf); var acc = pf.Accounts.FirstOrDefault(a => a.AccountId == account.AccountId); Assert.IsNotNull(acc); Assert.IsNotNull(acc.AssetTransactions.FirstOrDefault(t => t.TickerSymbol == "MSFT")); } }
public void SetUp() { this.model = new IpmModel(); Assert.IsNotNull(this.model); this.model.Database.Log = Console.Write; }
public PortfolioSummaryViewModel(IpmModel ipmModel, IRegionManager regionManager) { this.ipmModel = ipmModel; this.regionManager = regionManager; this.openAccountCommand = new DelegateCommand <int?>(this.ExecuteOpenAccount); }
public AccountSummaryViewModel(IpmModel ipmModel, IRegionManager regionManager) { this.ipmModel = ipmModel; this.regionManager = regionManager; }