예제 #1
0
        public void TestGetSafeFileName()
        {
            const string fileName     = "a+b:c/d";
            string       safeFileName = TheCommonUtils.GetSafeFileName(fileName, "json", true);
            var          dateTimePart = safeFileName.Substring(fileName.Length + 1, 17);
            var          timestamp    = DateTime.ParseExact(dateTimePart, "yyyyMMddHHmmfffff", CultureInfo.InvariantCulture);

            Assert.AreEqual(safeFileName, $"a+b_c_d_{timestamp:yyyyMMddHHmmfffff}.json", "Actual File Name: " + safeFileName);
        }
예제 #2
0
        public void TestGetSafeFileNameInvalidExtension()
        {
            string safeFileName = TheCommonUtils.GetSafeFileName("a+b:c/d", "jso", false);

            Assert.IsTrue(safeFileName.Equals("a+b_c_d.jso"), "Actual File Name: " + safeFileName);
        }
예제 #3
0
        public void TestGetSafeFileNameNoTimeStamp()
        {
            string safeFileName = TheCommonUtils.GetSafeFileName("a+b:c/d", "json", false);

            Assert.IsTrue(safeFileName.Equals("a+b_c_d.json"), "Actual File Name: " + safeFileName);
        }