public void BaseStockConstructorTest() { string name = baseStockTestName; BaseStock target = new BaseStock(name); Assert.IsTrue(Directory.Exists(appDataPath + "\\" + baseStockTestName), "OOPS! Stock directory does not exist."); }
public void DeleteStockTest() { string name = baseStockTestName; BaseStock target = new BaseStock(name); target.DeleteStock(); Assert.IsFalse(Directory.Exists(appDataPath + "\\" + baseStockTestName), "SHIT! Deleted stock directory still exists."); }
public void GetChildStockRefTest() { string name = baseStockTestName; BaseStock target = new BaseStock(name); string name1 = "Child stock"; BaseStock actual; actual = target.GetChildStockRef(name1); Assert.IsTrue(actual != null, "DOH! Child stock is null."); Assert.IsTrue(Directory.Exists(appDataPath + "\\" + baseStockTestName + "\\" + name1), "GOSH! Child stock directory was not created."); }
public void GetChildFileTest1() { string name = baseStockTestName; BaseStock target = new BaseStock(name); string name1 = "File"; FileStream actual; actual = target.GetChildFile(name1); Assert.AreEqual(appDataPath + "\\" + baseStockTestName + "\\" + name1, actual.Name, "DAMN! Returned FileStream has different name than it should."); actual.Close(); }
public void isStockReusedTest1() { string name = baseStockTestName; BaseStock stock = new BaseStock(name); PrivateObject param0 = new PrivateObject(stock); BaseStock_Accessor target = new BaseStock_Accessor(param0); bool expected = false; bool actual; target.isStockReused = expected; actual = target.isStockReused; Assert.AreEqual(expected, actual, "OH NO! Not reused stock is marked as reused."); }
public void GetChildFileTest() { string name = baseStockTestName; BaseStock target = new BaseStock(name); string name1 = "File"; BaseStock.Initializer func = delegate(FileStream s) { ++initializerFuncCounter; }; FileStream actual; actual = target.GetChildFile(name1, func); Assert.AreEqual(actual.Name, appDataPath + "\\" + baseStockTestName + "\\" + name1, "DAMN! Returned FileStream has different name than it should."); Assert.IsTrue(initializerFuncCounter == 1, "DAMN! Initializer functions was not called."); actual.Close(); }
public void DeleteChildFileTest() { string name = baseStockTestName; BaseStock target = new BaseStock(name); string name1 = "File"; BaseStock.Initializer func = delegate(FileStream s) { ++initializerFuncCounter; }; FileStream actual; actual = target.GetChildFile(name1); actual.Close(); target.DeleteChildFile(name1); Assert.IsFalse(File.Exists(appDataPath + "\\" + baseStockTestName + "\\" + name1), "GOSH! Child file exist after deletion."); }
public void Test_ExchangeFindStockException() { string stock = "GIN"; double lastDividend = 8; double fixedDividend = 2; double parValue = 100; double stockPrice = 25; GBCE exchange = new GBCE(); exchange.addPreferredStock(stock, lastDividend, fixedDividend, parValue, stockPrice); stock = "POP"; BaseStock selectedStock = exchange.GetStock(stock); }
public void isRemovedTest() { string name = baseStockTestName; BaseStock stock = new BaseStock(name); stock.DeleteStock(); PrivateObject param0 = new PrivateObject(stock); BaseStock_Accessor target = new BaseStock_Accessor(param0); bool expected = true; bool actual; target.isRemoved = expected; actual = target.isRemoved; Assert.AreEqual(expected, actual, "EWW! Removed object is not marked as removed."); }
public void Test_ExchangeFindStock() { string stock = "GIN"; double lastDividend = 8; double fixedDividend = 2; double parValue = 100; double stockPrice = 25; GBCE exchange = new GBCE(); exchange.addPreferredStock(stock, lastDividend, fixedDividend, parValue, stockPrice); stock = "POP"; lastDividend = 4; stockPrice = 50; exchange.addCommonStock(stock, lastDividend, stockPrice); Assert.AreEqual(2, exchange.stocks.Count); //Verify there are two stocks in the exchange BaseStock selectedStock = exchange.GetStock(stock); Assert.AreEqual(50, selectedStock.stockPrice); //Verify it has the correct stock price }