当前位置: 首页>>代码示例>>C#>>正文


C# ModuleScope.ObtainDynamicModuleWithWeakName方法代码示例

本文整理汇总了C#中ModuleScope.ObtainDynamicModuleWithWeakName方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleScope.ObtainDynamicModuleWithWeakName方法的具体用法?C# ModuleScope.ObtainDynamicModuleWithWeakName怎么用?C# ModuleScope.ObtainDynamicModuleWithWeakName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModuleScope的用法示例。


在下文中一共展示了ModuleScope.ObtainDynamicModuleWithWeakName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ModuleScopeCanHandleSignedAndUnsignedInParallel

		public void ModuleScopeCanHandleSignedAndUnsignedInParallel()
		{
			var scope = new ModuleScope();
			Assert.IsNull(scope.StrongNamedModule);
			Assert.IsNull(scope.WeakNamedModule);

			var one = scope.ObtainDynamicModuleWithStrongName();
			Assert.IsNotNull(scope.StrongNamedModule);
			Assert.IsNull(scope.WeakNamedModule);
			Assert.AreSame(one, scope.StrongNamedModule);

			var two = scope.ObtainDynamicModuleWithWeakName();
			Assert.IsNotNull(scope.StrongNamedModule);
			Assert.IsNotNull(scope.WeakNamedModule);
			Assert.AreSame(two, scope.WeakNamedModule);

			Assert.AreNotSame(one, two);
			Assert.AreNotSame(one.Assembly, two.Assembly);

			var three = scope.ObtainDynamicModuleWithStrongName();
			var four = scope.ObtainDynamicModuleWithWeakName();

			Assert.AreSame(one, three);
			Assert.AreSame(two, four);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:25,代码来源:ModuleScopeTestCase.cs

示例2: ImplicitModulePaths

		public void ImplicitModulePaths()
		{
			var scope = new ModuleScope(true);
			Assert.AreEqual(ModuleScope.DEFAULT_FILE_NAME, scope.StrongNamedModuleName);
			Assert.AreEqual(Path.Combine(Directory.GetCurrentDirectory(), ModuleScope.DEFAULT_FILE_NAME),
			                scope.ObtainDynamicModuleWithStrongName().FullyQualifiedName);
			Assert.IsNull(scope.StrongNamedModuleDirectory);

			Assert.AreEqual(ModuleScope.DEFAULT_FILE_NAME, scope.WeakNamedModuleName);
			Assert.AreEqual(Path.Combine(Directory.GetCurrentDirectory(), ModuleScope.DEFAULT_FILE_NAME),
			                scope.ObtainDynamicModuleWithWeakName().FullyQualifiedName);
			Assert.IsNull(scope.WeakNamedModuleDirectory);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:13,代码来源:ModuleScopeTestCase.cs

示例3: ModuleScopeDoesntTryToDeleteFromCurrentDirectory

		public void ModuleScopeDoesntTryToDeleteFromCurrentDirectory()
		{
			var moduleDirectory = Path.Combine(Directory.GetCurrentDirectory(), "GeneratedDlls");
			if (Directory.Exists(moduleDirectory))
				Directory.Delete(moduleDirectory, true);

			var strongModulePath = Path.Combine(moduleDirectory, "Strong.dll");
			var weakModulePath = Path.Combine(moduleDirectory, "Weak.dll");

			Directory.CreateDirectory(moduleDirectory);
			var scope = new ModuleScope(true, false, "Strong", strongModulePath, "Weak", weakModulePath);

			using (File.Create(Path.Combine(Directory.GetCurrentDirectory(), "Strong.dll")))
			{
				scope.ObtainDynamicModuleWithStrongName();
				scope.SaveAssembly(true); // this will throw if SaveAssembly tries to delete from the current directory
			}

			using (File.Create(Path.Combine(Directory.GetCurrentDirectory(), "Weak.dll")))
			{
				scope.ObtainDynamicModuleWithWeakName();
				scope.SaveAssembly(false); // this will throw if SaveAssembly tries to delete from the current directory
			}

			// Clean up the generated DLLs because the FileStreams are now closed
			Directory.Delete(moduleDirectory, true);
			File.Delete(Path.Combine(Directory.GetCurrentDirectory(), "Strong.dll"));
			File.Delete(Path.Combine(Directory.GetCurrentDirectory(), "Weak.dll"));
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:29,代码来源:ModuleScopeTestCase.cs

示例4: GeneratedAssembliesWithCustomName

		public void GeneratedAssembliesWithCustomName()
		{
			var scope = new ModuleScope(false,false, "Strong", "Module1.dll", "Weak", "Module2,dll");
			var strong = scope.ObtainDynamicModuleWithStrongName();
			var weak = scope.ObtainDynamicModuleWithWeakName();

			Assert.AreEqual("Strong", strong.Assembly.GetName().Name);
			Assert.AreEqual("Weak", weak.Assembly.GetName().Name);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:9,代码来源:ModuleScopeTestCase.cs

示例5: GeneratedAssembliesDefaultName

		public void GeneratedAssembliesDefaultName()
		{
			var scope = new ModuleScope();
			var strong = scope.ObtainDynamicModuleWithStrongName();
			var weak = scope.ObtainDynamicModuleWithWeakName();

			Assert.AreEqual(ModuleScope.DEFAULT_ASSEMBLY_NAME, strong.Assembly.GetName().Name);
			Assert.AreEqual(ModuleScope.DEFAULT_ASSEMBLY_NAME, weak.Assembly.GetName().Name);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:9,代码来源:ModuleScopeTestCase.cs

示例6: SavedAssemblyHasCacheMappings

		public void SavedAssemblyHasCacheMappings()
		{
			var scope = new ModuleScope(true);
			scope.ObtainDynamicModuleWithWeakName();

			var savedPath = scope.SaveAssembly();

			CrossAppDomainCaller.RunInOtherAppDomain(delegate(object[] args)
			                                         	{
			                                         		var assembly = Assembly.LoadFrom((string) args[0]);
			                                         		Assert.IsTrue(assembly.IsDefined(typeof (CacheMappingsAttribute), false));
			                                         	},
			                                         savedPath);

			File.Delete(savedPath);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:16,代码来源:ModuleScopeTestCase.cs

示例7: ExplicitSaveThrowsWhenSpecifiedAssemblyNotGeneratedStrongName

		public void ExplicitSaveThrowsWhenSpecifiedAssemblyNotGeneratedStrongName()
		{
			var scope = new ModuleScope(true);
			scope.ObtainDynamicModuleWithWeakName();

			Assert.Throws<InvalidOperationException>(() => scope.SaveAssembly(true));
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:7,代码来源:ModuleScopeTestCase.cs

示例8: ModuleScopeDoesntTryToDeleteFromCurrentDirectory

    public void ModuleScopeDoesntTryToDeleteFromCurrentDirectory ()
    {
      string moduleDirectory = Path.Combine (Environment.CurrentDirectory, "GeneratedDlls");
      if (Directory.Exists (moduleDirectory))
        Directory.Delete (moduleDirectory, true);

      string strongModulePath = Path.Combine (moduleDirectory, "Strong.dll");
      string weakModulePath = Path.Combine (moduleDirectory, "Weak.dll");
      
      Directory.CreateDirectory(moduleDirectory);
      ModuleScope scope = new ModuleScope (true, "Strong", strongModulePath, "Weak", weakModulePath);

      using (File.Create (Path.Combine (Environment.CurrentDirectory, "Strong.dll")))
      {
        scope.ObtainDynamicModuleWithStrongName ();
        scope.SaveAssembly (true); // this will throw if SaveAssembly tries to delete from the current directory
      }

      using (File.Create (Path.Combine (Environment.CurrentDirectory, "Weak.dll")))
      {
        scope.ObtainDynamicModuleWithWeakName ();
        scope.SaveAssembly (false);  // this will throw if SaveAssembly tries to delete from the current directory
      }
    }
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:24,代码来源:ModuleScopeTestCase.cs

示例9: SaveWithFlagFalseDoesntThrowsWhenMultipleAssembliesGenerated

		public void SaveWithFlagFalseDoesntThrowsWhenMultipleAssembliesGenerated()
		{
			var scope = new ModuleScope(false);
			scope.ObtainDynamicModuleWithStrongName();
			scope.ObtainDynamicModuleWithWeakName();

			scope.SaveAssembly();
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:8,代码来源:ModuleScopeTestCase.cs

示例10: SaveThrowsWhenMultipleAssembliesGenerated

		public void SaveThrowsWhenMultipleAssembliesGenerated()
		{
			var scope = new ModuleScope(true);
			scope.ObtainDynamicModuleWithStrongName();
			scope.ObtainDynamicModuleWithWeakName();

			Assert.Throws<InvalidOperationException>(() => scope.SaveAssembly());
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:8,代码来源:ModuleScopeTestCase.cs

示例11: SaveWithPath

		public void SaveWithPath()
		{
			var strongModulePath = Path.GetTempFileName();
			var weakModulePath = Path.GetTempFileName();

			File.Delete(strongModulePath);
			File.Delete(weakModulePath);

			Assert.IsFalse(File.Exists(strongModulePath));
			Assert.IsFalse(File.Exists(weakModulePath));

			var scope = new ModuleScope(true,false, "Strong", strongModulePath, "Weak", weakModulePath);
			scope.ObtainDynamicModuleWithStrongName();
			scope.ObtainDynamicModuleWithWeakName();

			scope.SaveAssembly(true);
			scope.SaveAssembly(false);

			Assert.IsTrue(File.Exists(strongModulePath));
			Assert.IsTrue(File.Exists(weakModulePath));

			File.Delete(strongModulePath);
			File.Delete(weakModulePath);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:24,代码来源:ModuleScopeTestCase.cs

示例12: SaveUnsigned

		public void SaveUnsigned()
		{
			var scope = new ModuleScope(true);
			scope.ObtainDynamicModuleWithWeakName();

			var path = ModuleScope.DEFAULT_FILE_NAME;
			if (File.Exists(path))
				File.Delete(path);

			Assert.IsFalse(File.Exists(path));
			var savedPath = scope.SaveAssembly();

			Assert.AreEqual(savedPath, Path.GetFullPath(path));

			CheckUnsignedSavedAssembly(path);
			File.Delete(path);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:17,代码来源:ModuleScopeTestCase.cs

示例13: ExplicitSaveThrowsWhenSpecifiedAssemblyNotGeneratedStrongName

		public void ExplicitSaveThrowsWhenSpecifiedAssemblyNotGeneratedStrongName()
		{
			var scope = new ModuleScope(true);
			scope.ObtainDynamicModuleWithWeakName();

			scope.SaveAssembly(true);
		}
开发者ID:leloulight,项目名称:Core,代码行数:7,代码来源:ModuleScopeTestCase.cs

示例14: SaveThrowsWhenMultipleAssembliesGenerated

		public void SaveThrowsWhenMultipleAssembliesGenerated()
		{
			ModuleScope scope = new ModuleScope(true);
			scope.ObtainDynamicModuleWithStrongName();
			scope.ObtainDynamicModuleWithWeakName();

			scope.SaveAssembly();
		}
开发者ID:AGiorgetti,项目名称:Castle.Core,代码行数:8,代码来源:ModuleScopeTestCase.cs

示例15: ExplicitSaveWorksEvenWhenMultipleAssembliesGenerated

		public void ExplicitSaveWorksEvenWhenMultipleAssembliesGenerated()
		{
			var scope = new ModuleScope(true);
			scope.ObtainDynamicModuleWithStrongName();
			scope.ObtainDynamicModuleWithWeakName();

			scope.SaveAssembly(true);
			CheckSignedSavedAssembly(ModuleScope.DEFAULT_FILE_NAME);

			scope.SaveAssembly(false);
			CheckUnsignedSavedAssembly(ModuleScope.DEFAULT_FILE_NAME);

			File.Delete(ModuleScope.DEFAULT_FILE_NAME);
		}
开发者ID:jeremymeng,项目名称:Core,代码行数:14,代码来源:ModuleScopeTestCase.cs


注:本文中的ModuleScope.ObtainDynamicModuleWithWeakName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。