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); }
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); }
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); }