Ejemplo n.º 1
0
        /// <summary>
        /// Get the path to a file included in the test project as something to
        /// be copied on Deployment (see Local.testsettings > Deployment for
        /// examples).
        /// </summary>
        /// <param name="relativePath">Relative path to the resource.</param>
        /// <returns>Path to the resource.</returns>
        public static string GetAssemblyTestResourcePath <TResourceLocator>(string relativePath)
        {
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, relativePath);

            try
            {
                EmbeddedFileWriter.WriteResourceToDisk <TResourceLocator>(relativePath, path);
            }
            catch
            {
                Console.WriteLine(path);
                throw;
            }
            Assert.IsTrue(File.Exists(path));
            return(path);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the path to a file included in the test project as something to
        /// be copied on Deployment (see Local.testsettings > Deployment for
        /// examples).
        /// </summary>
        /// <param name="relativePath">Relative path to the resource.</param>
        /// <returns>Path to the resource.</returns>
        public static string GetTestResourcePath(string relativePath)
        {
            string path = Path.Combine(Environment.CurrentDirectory, relativePath);

            try
            {
                EmbeddedFileWriter.WriteResourceToDisk <ResourceLocator>(relativePath, path);
            }
            catch
            {
                Console.WriteLine(path);
                throw;
            }
            Assert.IsTrue(File.Exists(path));
            return(path);
        }