public void SaveAssemblyNoGeneratedTypes() { ModuleScope scope = new ModuleScope(true); string[] paths = AssemblySaver.SaveAssemblies(scope); Assert.That(paths.Length, Is.EqualTo(0)); }
public void SaveAssemblyUnsigned() { ModuleScope scope = new ModuleScope(true); CustomClassEmitter emitter = new CustomClassEmitter(scope, "UnsignedType", typeof(object), Type.EmptyTypes, TypeAttributes.Public, true); emitter.BuildType(); string[] paths = AssemblySaver.SaveAssemblies(scope); Assert.That(paths.Length, Is.EqualTo(1)); Assert.That(paths[0], Is.EqualTo(Path.Combine(Environment.CurrentDirectory, scope.WeakNamedModuleName))); File.Delete(paths[0]); File.Delete(paths[0].Replace(".dll", ".pdb")); }
public virtual void TearDown() { Console.WriteLine("Tearing down code generation tests"); #if !NO_PEVERIFY string[] paths = AssemblySaver.SaveAssemblies(s_scope); s_scope = null; s_unsavedScope = null; foreach (string path in paths) { PEVerifier.CreateDefault().VerifyPEFile(path); FileUtility.DeleteAndWaitForCompletion(path); FileUtility.DeleteAndWaitForCompletion(path.Replace(".dll", ".pdb")); } #endif }