Пример #1
0
        public void BaseStockConstructorTest()
        {
            string name = baseStockTestName;
            BaseStock target = new BaseStock(name);

            Assert.IsTrue(Directory.Exists(appDataPath + "\\" + baseStockTestName), "OOPS! Stock directory does not exist.");
        }
Пример #2
0
        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.");
        }
Пример #3
0
        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.");
        }
Пример #4
0
 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.");
 }
Пример #5
0
 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();
 }
Пример #6
0
 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();
 }
Пример #7
0
 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.");
 }
Пример #8
0
 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.");
 }