Beispiel #1
0
        public static void AttachText(this NUnit.Framework.TestContext context, string fileName, string[] lines)
        {
            fileName = context.GetAttachmentPath(fileName, true);

            System.IO.File.WriteAllLines(fileName, lines.ToArray());

            NUnit.Framework.TestContext.AddTestAttachment(fileName);
        }
Beispiel #2
0
        public static void AttachUrlLink(this NUnit.Framework.TestContext context, string linkPath, string url)
        {
            var sb = new StringBuilder();

            sb.AppendLine("[InternetShortcut]");
            sb.AppendLine("URL=" + url);

            linkPath = System.IO.Path.ChangeExtension(linkPath, ".url");
            linkPath = context.GetAttachmentPath(linkPath, true);

            System.IO.File.WriteAllText(linkPath, sb.ToString());

            NUnit.Framework.TestContext.AddTestAttachment(linkPath);
        }
Beispiel #3
0
        public static void AttachFileLink(this NUnit.Framework.TestContext context, string linkPath, string targetPath)
        {
            var sb = new StringBuilder();

            sb.AppendLine("[InternetShortcut]");
            sb.AppendLine("URL=file:///" + targetPath);
            sb.AppendLine("IconIndex=0");
            string icon = targetPath.Replace('\\', '/');

            sb.AppendLine("IconFile=" + icon);

            linkPath = System.IO.Path.ChangeExtension(linkPath, ".url");
            linkPath = context.GetAttachmentPath(linkPath, true);

            System.IO.File.WriteAllText(linkPath, sb.ToString());

            NUnit.Framework.TestContext.AddTestAttachment(linkPath);
        }
Beispiel #4
0
 public static void AttachShowDirLink(this NUnit.Framework.TestContext context)
 {
     context.AttachFileLink("📂 Show Directory", context.GetAttachmentPath(string.Empty));
 }