Exemplo n.º 1
0
        public void GetandSetCreatedTimeTest()
        {
            DateTime min = DateTime.MinValue;
            FileNode file_na = new FileNode(fileName, fileID, modifiedTime, "N / A", executeTime, extension, filePath);
            FileNode file01 = new FileNode(fileName, fileID, modifiedTime, "0001/01/01 00:00:00", executeTime, extension, filePath);
            FileNode file02 = new FileNode(fileName, fileID, min, min, min, extension, filePath);
            FileNode file = new FileNode(fileName, fileID, modifiedTime, createdTime, executeTime, extension, filePath);

            //test when input is "N / A"
            String actualcreatedTime_na = file_na.GetCreatedTimeS();
            Assert.AreEqual("", actualcreatedTime_na, "Actual created time is not empty when input is N / A");

            //test get method when input is string-type min value
            String actualcreatedTime01 = file01.GetCreatedTimeS();
            Assert.AreEqual("", actualcreatedTime01, "Actual created time is not empty when input is 0001/01/01 00:00:00");

            //test get method when input is DateTime-type min value
            String actualcreatedTime02 = file02.GetCreatedTimeS();
            Assert.AreEqual("", actualcreatedTime02, "Actual created time is not empty when input is 0001/01/01 00:00:00");

            //test get method when input is not min value or "N / A"
            String actualcreatedTime1 = file.GetCreatedTimeS();
            Assert.AreEqual("2017/04/01 01:00:00", actualcreatedTime1, "Actual created time is not 2017/04/01 01:00:00");

            //test set method when input is empty string
            file.SetCreatedTime("");
            String actualcreatedTime2 = file.GetCreatedTimeS();
            Assert.AreEqual("", actualcreatedTime2, "Actual created time is not empty when the created time is set to be empty string");

            //test set method when input is "N / A"
            file.SetCreatedTime("N / A");
            String actualcreatedTime3 = file.GetCreatedTimeS();
            Assert.AreEqual("", actualcreatedTime3, "Actual created time is not empty when the created time is set to be N / A");

            //test set method when input is MinValue
            file.SetCreatedTime("0001/01/01 00:00:00");
            String actualcreatedTime4 = file.GetCreatedTimeS();
            Assert.AreEqual("", actualcreatedTime4, "Actual created time is not empty when the created time is set to be MinValue");

            //test set method when input is not MinValue
            file.SetCreatedTime("2016/11/30 18:00:00");
            String actualcreatedTime5 = file.GetCreatedTimeS();
            Assert.AreEqual("2016/11/30 18:00:00", actualcreatedTime5, "Actual created time is not 2016/11/30 18:00:00");
        }