public void SavePortfolioTest() { PortfolioManager.Clear(); Assert.IsTrue(PortfolioManager.TryToCreate(DataGenerator.GetRandomString(5), DataGenerator.GetRandomString(6), out Portfolio portfolio)); Assert.IsTrue(PortfolioManager.TryToCreate(DataGenerator.GetRandomString(5), DataGenerator.GetRandomString(6), out Portfolio portfolio2)); Assert.IsTrue(PortfolioManager.TryToCreate(DataGenerator.GetRandomString(5), DataGenerator.GetRandomString(6), out Portfolio portfolio3)); PortfolioManager.SavePortfolios(); Assert.AreEqual(0, PortfolioManager.PortfolioCount); Assert.IsTrue(File.Exists(PortfolioManager.PortfolioData)); PortfolioManager.Clear(); }
public void LoadPortfolioTest() { File.Delete(PortfolioManager.PortfolioData); PortfolioManager.Clear(); Assert.IsTrue(PortfolioManager.TryToCreate(DataGenerator.GetRandomString(5), DataGenerator.GetRandomString(6), out Portfolio portfolio1)); Assert.IsTrue(PortfolioManager.TryToCreate(DataGenerator.GetRandomString(5), DataGenerator.GetRandomString(6), out Portfolio portfolio2)); Assert.IsTrue(PortfolioManager.TryToCreate(DataGenerator.GetRandomString(5), DataGenerator.GetRandomString(6), out Portfolio portfolio3)); PortfolioManager.SavePortfolios(); PortfolioManager.LoadPortfolios(); Assert.IsTrue(PortfolioManager.TryToGet(portfolio1.PortfolioID, out Portfolio p1)); Assert.IsTrue(PortfolioManager.TryToGet(portfolio2.PortfolioID, out Portfolio p2)); Assert.IsTrue(PortfolioManager.TryToGet(portfolio3.PortfolioID, out Portfolio p3)); Assert.IsTrue(p1.Equals(portfolio1)); Assert.IsTrue(p2.Equals(portfolio2)); Assert.IsTrue(p3.Equals(portfolio3)); PortfolioManager.TryToRemove(portfolio1.PortfolioID); PortfolioManager.TryToRemove(portfolio2.PortfolioID); PortfolioManager.TryToRemove(portfolio3.PortfolioID); }
public void TestInitialize() { PortfolioManager.Clear(); ComService.AddUdpClient(Config.DEFAULT_UDP_CLIENT, 0); ConversationManager.Start(ConversationBuilder); }