public void AdviserCanCreateClientForGroup() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Test", "Adviser").Result; adviser.CreateNewClientGroup(new ClientGroupRegistration() { AdviserNumber = adviser.AdviserNumber, FirstName = "client first name", LastName = "client last name", Address = "668 Bourke Street, Melbourne, 3000, Victoria", Dob = DateTime.Now, Phone = "03699999", Email = "Email" }).Wait(); //adviser.SetProfileEndDate(DateTime.Now); var groups = adviser.GetAllClientGroups().Result; adviser.CreateNewClient(new ClientRegistration() { GroupNumber = groups[0].ClientGroupNumber, FirstName = "second first name", LastName = "second last name", Address = "address", Dob = DateTime.Now, Phone = "039999999", Email = "*****@*****.**" }).Wait(); //adviser.SetProfileEndDate(DateTime.Now); groups = adviser.GetAllClientGroups().Result; Assert.IsTrue(groups.Count == 1); Assert.IsTrue(groups[0].GetClients().Result.Count == 2); repo.Dispose(); }
public void CanCreateAdviser() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Test", "Adviser").Result; Assert.IsTrue(adviser.FirstName == "Test"); repo.Dispose(); }
public void CanCalculateAssetCashAccountTypeDiversification() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Test", "Adviser").Result; adviser.CreateNewClientGroup(new ClientGroupRegistration() { AdviserNumber = adviser.AdviserNumber, FirstName = "client first name", LastName = "client last name", Address = "668 Bourke Street, Melbourne, 3000, Victoria", Dob = DateTime.Now, Phone = "03699999", Email = "Email" }).Wait(); var groups = adviser.GetAllClientGroups().Result; groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait(); var account = groups[0].GetAccounts()[0]; account.MakeTransaction(new CashAccountTransactionAccountCreation() { Amount = 150000, AnnualInterestSoFar = 0, Bsb = "123456", CashAccountName = "Account name", CashAccountNumber = "Number", CashAccountType = CashAccountType.TermDeposit, CurrencyType = CurrencyType.AustralianDollar, Frequency = Frequency.Annually, InterestRate = 0.9, MaturityDate = DateTime.Now.AddYears(1), TermsInMonths = 20, TransactionDate = DateTime.Now, TransactionFeeRecords = new List <TransactionFeeRecordCreation>() { new TransactionFeeRecordCreation() { Amount = 1000, TransactionExpenseType = TransactionExpenseType.AdviserTransactionFee } } }).Wait(); var assets = account.GetAssets(); var cashAccountDiversification = assets.GetCashAccountTypeDiversification(repo).Result; Assert.IsTrue(cashAccountDiversification.Count == 5); Assert.IsTrue(cashAccountDiversification["TermDeposit"] == 150000); repo.Dispose(); }
public void AccountCanMakeTransactionWithExpenses() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Test", "Adviser").Result; adviser.CreateNewClientGroup(new ClientGroupRegistration() { AdviserNumber = adviser.AdviserNumber, FirstName = "client first name", LastName = "client last name", Address = "668 Bourke Street, Melbourne, 3000, Victoria", Dob = DateTime.Now, Phone = "03699999", Email = "Email" }).Wait(); var groups = adviser.GetAllClientGroups().Result; groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait(); var account = groups[0].GetAccounts()[0]; account.MakeTransaction(new EquityTransactionCreation() { EquityType = EquityTypes.AustralianEquity, FeesRecords = new List <TransactionFeeRecordCreation>() { new TransactionFeeRecordCreation() { Amount = 100, TransactionExpenseType = TransactionExpenseType.Brokerage } }, Name = "Test Stock", NumberOfUnits = 100, Price = 20, Sector = "Test Sector", Ticker = "Test Ticker 01", TransactionDate = DateTime.Now, }).Wait(); account = groups[0].GetAccounts()[0]; Assert.IsTrue(account.GetAssets().Count == 1); var asset = account.GetAssets()[0]; Assert.IsTrue(asset.LatestPrice == 20); Assert.IsTrue(asset.TotalNumberOfUnits == 100); var assets = account.GetAssets(); var marketvalue = assets.GetTotalMarketValue(); var cost = assets.GetTotalCost(); Assert.IsTrue(marketvalue == 2000); Assert.IsTrue(cost.AssetCost == 2000); Assert.IsTrue(cost.Total == 2100); Assert.IsTrue(cost.Expense == 100); repo.Dispose(); }
public void CanUpdateAdviser() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Steven", "Wang").Result; adviser.FirstName = "Zhenhao"; var adviser2 = repo.UpdateAdviser(adviser, DateTime.Now).Result; Console.WriteLine(adviser2.FirstName); Assert.IsTrue(adviser.FirstName == "Zhenhao"); repo.Dispose(); }
public void TestMethod1() { EdisRepository repo = new EdisRepository(); var account = repo.CreateNewClientGroupAccountSync("70b77f8c-9385-427d-adbf-59c224d6d9d8", "", AccountType.GenenralPurpose); var equity = repo.getEquityByTicker("PHAR"); account.MakeTransactionSync(new EquityTransactionCreation() { FeesRecords = new List <TransactionFeeRecordCreation>(), Name = equity.Name, NumberOfUnits = 100, Price = 10, Sector = equity.Sector, Ticker = equity.Ticker, TransactionDate = DateTime.Now.AddDays(-10) }); account.MakeTransactionSync(new EquityTransactionCreation() { FeesRecords = new List <TransactionFeeRecordCreation>(), Name = equity.Name, NumberOfUnits = -50, Price = 5, Sector = equity.Sector, Ticker = equity.Ticker, TransactionDate = DateTime.Now.AddDays(-9) }); var asset = account.GetAssets()[0]; var assets = account.GetAssets(); var marketvalue = assets.GetTotalMarketValue(); var cost = assets.GetTotalCost(); Assert.IsTrue(marketvalue == 0); //Assert.IsTrue(cost.) Assert.IsTrue(cost.AssetCost == 1000); Assert.IsTrue(cost.Total == 1000); Assert.IsTrue(cost.Expense == 1000); repo.Dispose(); }
public void AdviserCanCreateClientWithProperAgeCalculation() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Test", "Adviser").Result; adviser.CreateNewClientGroup(new ClientGroupRegistration() { AdviserNumber = adviser.AdviserNumber, FirstName = "client first name", LastName = "client last name", Address = "668 Bourke Street, Melbourne, 3000, Victoria", Dob = DateTime.Now.AddYears(-12), Phone = "03699999", Email = "Email" }).Wait(); var groups = adviser.GetAllClientGroups().Result; Assert.IsTrue(groups[0].GetClients().Result[0].Age == 12); repo.Dispose(); }
public void TestMethod1() { EdisRepository repo = new EdisRepository(); var account = repo.CreateNewClientGroupAccountSync("70b77f8c-9385-427d-adbf-59c224d6d9d8", "", AccountType.GenenralPurpose); var equity = repo.getEquityByTicker("PHAR"); account.MakeTransactionSync(new EquityTransactionCreation() { FeesRecords = new List<TransactionFeeRecordCreation>(), Name = equity.Name, NumberOfUnits = 100, Price = 10, Sector = equity.Sector, Ticker = equity.Ticker, TransactionDate = DateTime.Now.AddDays(-10) }); account.MakeTransactionSync(new EquityTransactionCreation() { FeesRecords = new List<TransactionFeeRecordCreation>(), Name = equity.Name, NumberOfUnits = -50, Price = 5, Sector = equity.Sector, Ticker = equity.Ticker, TransactionDate = DateTime.Now.AddDays(-9) }); var asset = account.GetAssets()[0]; var assets = account.GetAssets(); var marketvalue = assets.GetTotalMarketValue(); var cost = assets.GetTotalCost(); Assert.IsTrue(marketvalue == 0); //Assert.IsTrue(cost.) Assert.IsTrue(cost.AssetCost == 1000); Assert.IsTrue(cost.Total == 1000); Assert.IsTrue(cost.Expense == 1000); repo.Dispose(); }
public void AdviserCanCreateGroupAccount() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Test", "Adviser").Result; adviser.CreateNewClientGroup(new ClientGroupRegistration() { AdviserNumber = adviser.AdviserNumber, FirstName = "client first name", LastName = "client last name", Address = "668 Bourke Street, Melbourne, 3000, Victoria", Dob = DateTime.Now, Phone = "03699999", Email = "Email" }).Wait(); var groups = adviser.GetAllClientGroups().Result; groups[0].AddAccount("Testing", AccountType.GenenralPurpose).Wait(); Assert.IsTrue(groups[0].GetAccounts().Count == 1); repo.Dispose(); }
public void CanCalculateAssetSectorialDiversification() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Test", "Adviser").Result; adviser.CreateNewClientGroup(new ClientGroupRegistration() { AdviserNumber = adviser.AdviserNumber, FirstName = "client first name", LastName = "client last name", Address = "668 Bourke Street, Melbourne, 3000, Victoria", Dob = DateTime.Now, Phone = "03699999", Email = "Email" }).Wait(); var groups = adviser.GetAllClientGroups().Result; groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait(); var account = groups[0].GetAccounts()[0]; account.MakeTransaction(new EquityTransactionCreation() { EquityType = EquityTypes.AustralianEquity, FeesRecords = new List <TransactionFeeRecordCreation>() { new TransactionFeeRecordCreation() { Amount = 100, TransactionExpenseType = TransactionExpenseType.Brokerage } }, Name = "Test Stock", NumberOfUnits = 100, Price = 20, Sector = "Sector 1", Ticker = Guid.NewGuid().ToString(), TransactionDate = DateTime.Now, }).Wait(); account = groups[0].GetAccounts()[0]; Assert.IsTrue(account.GetAssets().Count == 1); var asset = account.GetAssets()[0]; Assert.IsTrue(asset.LatestPrice == 20); Assert.IsTrue(asset.TotalNumberOfUnits == 100); account.RecordIncome(new DividendPaymentCreation() { Amount = 200, Franking = 100, PaymentOn = DateTime.Now, Ticker = ((AustralianEquity)asset).Ticker }).Wait(); var assets = account.GetAssets(); var diversification = assets.GetAssetSectorialDiversification <AustralianEquity>(repo).Result; Assert.IsTrue(diversification.Count == 2); Assert.IsTrue(diversification["Sector 1"] == 2000); Assert.IsTrue(diversification["Sector 2"] == 0); repo.Dispose(); }
public void AccountCanCalculateProfitAndLoss() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Test", "Adviser").Result; adviser.CreateNewClientGroup(new ClientGroupRegistration() { AdviserNumber = adviser.AdviserNumber, FirstName = "client first name", LastName = "client last name", Address = "668 Bourke Street, Melbourne, 3000, Victoria", Dob = DateTime.Now, Phone = "03699999", Email = "Email" }).Wait(); var groups = adviser.GetAllClientGroups().Result; groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait(); var account = groups[0].GetAccounts()[0]; account.MakeTransaction(new EquityTransactionCreation() { EquityType = EquityTypes.AustralianEquity, FeesRecords = new List<TransactionFeeRecordCreation>() { new TransactionFeeRecordCreation() { Amount = 100, TransactionExpenseType = TransactionExpenseType.Brokerage } }, Name = "Test Stock", NumberOfUnits = 100, Price = 20, Sector = "Test Sector", Ticker = "Test Ticker 01", TransactionDate = DateTime.Now, }).Wait(); account = groups[0].GetAccounts()[0]; Assert.IsTrue(account.GetAssets().Count == 1); var asset = account.GetAssets()[0]; Assert.IsTrue(asset.LatestPrice == 20); Assert.IsTrue(asset.TotalNumberOfUnits == 100); account.RecordIncome(new DividendPaymentCreation() { Amount = 200, Franking = 100, PaymentOn = DateTime.Now, Ticker = ((AustralianEquity)asset).Ticker }).Wait(); var assets = account.GetAssets(); var marketvalue = assets.GetTotalMarketValue(); var cost = assets.GetTotalCost(); var income = assets.GetTotalIncome(); var profitLoss = assets.GetProfitAndLoss(); Assert.IsTrue(marketvalue == 2000); Assert.IsTrue(cost.AssetCost == 2000); Assert.IsTrue(cost.Total == 2100); Assert.IsTrue(cost.Expense == 100); Assert.IsTrue(income == 300); Assert.IsTrue(profitLoss == 200); repo.Dispose(); }
public void CanCalculateAssetCashAccountTypeDiversification() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Test", "Adviser").Result; adviser.CreateNewClientGroup(new ClientGroupRegistration() { AdviserNumber = adviser.AdviserNumber, FirstName = "client first name", LastName = "client last name", Address = "668 Bourke Street, Melbourne, 3000, Victoria", Dob = DateTime.Now, Phone = "03699999", Email = "Email" }).Wait(); var groups = adviser.GetAllClientGroups().Result; groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait(); var account = groups[0].GetAccounts()[0]; account.MakeTransaction(new CashAccountTransactionAccountCreation() { Amount = 150000, AnnualInterestSoFar = 0, Bsb = "123456", CashAccountName = "Account name", CashAccountNumber = "Number", CashAccountType = CashAccountType.TermDeposit, CurrencyType = CurrencyType.AustralianDollar, Frequency = Frequency.Annually, InterestRate = 0.9, MaturityDate = DateTime.Now.AddYears(1), TermsInMonths = 20, TransactionDate = DateTime.Now, TransactionFeeRecords = new List<TransactionFeeRecordCreation>() { new TransactionFeeRecordCreation() { Amount = 1000, TransactionExpenseType = TransactionExpenseType.AdviserTransactionFee } } }).Wait(); var assets = account.GetAssets(); var cashAccountDiversification = assets.GetCashAccountTypeDiversification(repo).Result; Assert.IsTrue(cashAccountDiversification.Count == 5); Assert.IsTrue(cashAccountDiversification["TermDeposit"] == 150000); repo.Dispose(); }
public void CanCalculateAssetSectorialDiversification() { var repo = new EdisRepository(); var adviser = repo.CreateAdviser("Test", "Adviser").Result; adviser.CreateNewClientGroup(new ClientGroupRegistration() { AdviserNumber = adviser.AdviserNumber, FirstName = "client first name", LastName = "client last name", Address = "668 Bourke Street, Melbourne, 3000, Victoria", Dob = DateTime.Now, Phone = "03699999", Email = "Email" }).Wait(); var groups = adviser.GetAllClientGroups().Result; groups[0].AddAccount("group account", AccountType.GenenralPurpose).Wait(); var account = groups[0].GetAccounts()[0]; account.MakeTransaction(new EquityTransactionCreation() { EquityType = EquityTypes.AustralianEquity, FeesRecords = new List<TransactionFeeRecordCreation>() { new TransactionFeeRecordCreation() { Amount = 100, TransactionExpenseType = TransactionExpenseType.Brokerage } }, Name = "Test Stock", NumberOfUnits = 100, Price = 20, Sector = "Sector 1", Ticker = Guid.NewGuid().ToString(), TransactionDate = DateTime.Now, }).Wait(); account = groups[0].GetAccounts()[0]; Assert.IsTrue(account.GetAssets().Count == 1); var asset = account.GetAssets()[0]; Assert.IsTrue(asset.LatestPrice == 20); Assert.IsTrue(asset.TotalNumberOfUnits == 100); account.RecordIncome(new DividendPaymentCreation() { Amount = 200, Franking = 100, PaymentOn = DateTime.Now, Ticker = ((AustralianEquity)asset).Ticker }).Wait(); var assets = account.GetAssets(); var diversification = assets.GetAssetSectorialDiversification<AustralianEquity>(repo).Result; Assert.IsTrue(diversification.Count == 2); Assert.IsTrue(diversification["Sector 1"] == 2000); Assert.IsTrue(diversification["Sector 2"] == 0); repo.Dispose(); }