Example #1
0
        public static byte[] Get(TestDocumentType type)
        {
            string docName = GetDocumentName(type);

            var assembly     = Assembly.GetExecutingAssembly();
            var resourceName = $"{typeof(TestDocument).Namespace}.Files.{docName}";

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
                using (MemoryStream ms = new MemoryStream())
                {
                    stream.CopyTo(ms);
                    var bytes = ms.ToArray();
                    return(ms.ToArray());
                }
        }
Example #2
0
        private static string GetDocumentName(TestDocumentType type)
        {
            switch (type)
            {
            case TestDocumentType.Pdf:
                return("Test.pdf");

            case TestDocumentType.LargePdf:
                return("Test_6mb.pdf");

            case TestDocumentType.Word:
                return("Word.docx");

            default:
                throw new InvalidOperationException();
            }
        }