public void Init() { var logEncoding = new UTF8Encoding(false); var logFile = ILogExtend.GetLogFilePath("TestISupport"); log = new FilePrintLog(logFile, logEncoding); // 测试开始前引用官方代码页引用, 增加支持中文GBK UseExtend.SupportCodePages(); }
public void TestCreate() { try { FileInfo fileInfo = ILogExtend.GetLogFilePath("TestFilePrintLog"); ILog log = new FilePrintLog(fileInfo, System.Text.Encoding.UTF8); log.Info("测试文件信息写入"); Assert.IsNotNull(log); Assert.IsTrue(fileInfo.Exists); string fullPath = fileInfo.FullName; Assert.IsTrue(!string.IsNullOrEmpty(fullPath)); fullPath = fullPath.Replace('\\', '/'); Assert.IsTrue(fullPath.IndexOf("/bin/Debug/") > -1); } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.IsTrue(false); } }