GetAssemblyPath() public static méthode

Gets the path from which an assembly was loaded. For builds where this is not possible, returns the name of the assembly.
public static GetAssemblyPath ( Assembly assembly ) : string
assembly System.Reflection.Assembly The assembly.
Résultat string
        public void GetPathForAssembly()
        {
            string path = AssemblyHelper.GetAssemblyPath(this.GetType().GetTypeInfo().Assembly);

            Assert.That(Path.GetFileName(path), Is.EqualTo(THIS_ASSEMBLY_PATH).IgnoreCase);

            Assert.That(File.Exists(path));
        }
        /// <summary>
        /// Build a suite of tests from a provided assembly
        /// </summary>
        /// <param name="assembly">The assembly from which tests are to be built</param>
        /// <param name="options">A dictionary of options to use in building the suite</param>
        /// <returns>
        /// A TestSuite containing the tests found in the assembly
        /// </returns>
        public ITest Build(Assembly assembly, IDictionary options)
        {
            this.assembly = assembly;

            IList fixtureNames = options["LOAD"] as IList;

            IList fixtures = GetFixtures(assembly, fixtureNames);

#if NETCF || SILVERLIGHT
            AssemblyName assemblyName = AssemblyHelper.GetAssemblyName(assembly);
            return(BuildTestAssembly(assemblyName.Name, fixtures));
#else
            string assemblyPath = AssemblyHelper.GetAssemblyPath(assembly);
            return(BuildTestAssembly(assemblyPath, fixtures));
#endif
        }
        /// <summary>
        /// Build a suite of tests from a provided assembly
        /// </summary>
        /// <param name="assembly">The assembly from which tests are to be built</param>
        /// <param name="options">A dictionary of options to use in building the suite</param>
        /// <returns>
        /// A TestSuite containing the tests found in the assembly
        /// </returns>
        public TestSuite Build(Assembly assembly, IDictionary options)
        {
            this.assembly = assembly;

            IList fixtureNames = options["LOAD"] as IList;

            IList fixtures = GetFixtures(assembly, fixtureNames);

            if (fixtures.Count > 0)
            {
#if NETCF || SILVERLIGHT || PORTABLE
                AssemblyName assemblyName = AssemblyHelper.GetAssemblyName(assembly);
                return(BuildTestAssembly(assemblyName.Name, fixtures));
#else
                string assemblyPath = AssemblyHelper.GetAssemblyPath(assembly);
                return(BuildTestAssembly(assemblyPath, fixtures));
#endif
            }

            return(null);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AssemblyReader"/> class.
 /// </summary>
 /// <param name="assembly">The assembly.</param>
 public AssemblyReader(Assembly assembly)
 {
     this.assemblyPath = AssemblyHelper.GetAssemblyPath(assembly);
     CalcHeaderOffsets();
 }