• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# AssemblyCache类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AssemblyCache的典型用法代码示例。如果您正苦于以下问题:C# AssemblyCache类的具体用法?C# AssemblyCache怎么用?C# AssemblyCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AssemblyCache类属于命名空间,在下文中一共展示了AssemblyCache类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetAssemblyCache

 private AssemblyCache GetAssemblyCache(Type classType, IConfiguration config)
 {
     if (_assemblyCache == null)
     {
         _assemblyCache = new Dictionary<Assembly, AssemblyCache>();
     }
     AssemblyCache cache = null;
     if (!_assemblyCache.TryGetValue(classType.Assembly, out cache))
     {
         cache = new AssemblyCache(classType.Assembly);
         foreach (JsonExDefaultValuesAttribute attr in classType.Assembly.GetCustomAttributes(typeof(JsonExDefaultValuesAttribute), false))
         {
             if (attr.DefaultValueSetting != DefaultValueOption.InheritParentSetting)
                 cache.defaultOption = attr.DefaultValueSetting;
             if (attr.Type != null)
             {
                 if (cache.defaultValues == null)
                     cache.defaultValues = new DefaultValueCollection(config.DefaultValues);
                 cache.defaultValues[attr.Type] = attr.DefaultValue;
             }
         }
         if (cache.defaultOption == DefaultValueOption.InheritParentSetting && cache.defaultValues != null)
             cache.defaultOption = DefaultValueOption.SuppressDefaultValues;
         _assemblyCache[classType.Assembly] = cache;
     }
     return cache;
 }
开发者ID:AugustoAngeletti,项目名称:blockspaces,代码行数:27,代码来源:JsonDefaultAttributeProcessor.cs


示例2: IsThisCall

		/// <summary>Returns true if we're calling an instance method with caller's this
		/// pointer, or if we're calling a static method in caller's declaring
		/// type with caller's this pointer as an argument.</summary>
		public bool IsThisCall(AssemblyCache cache, MethodInfo caller, int callIndex)
		{
			DBC.Pre(cache != null, "cache is null");				
			DBC.Pre(caller != null, "caller is null");
				
			if (!m_isThisCall.HasValue)
			{
				m_isThisCall = false;

				MethodInfo target = cache.FindMethod(Target);
				if (target != null && !target.Method.IsConstructor)
				{
					if (target.Method.HasThis)
					{
						int nth = target.Method.Parameters.Count;
						int j = caller.Tracker.GetStackIndex(callIndex, nth);
						
						if (j >= 0)
							m_isThisCall = caller.Instructions.LoadsThisArg(j);
					}
					else if (target.Method.IsStatic)
					{
						for (int i = 0; i < target.Method.Parameters.Count && !m_isThisCall.Value; ++i)
						{
							int j = caller.Tracker.GetStackIndex(callIndex, i);				

							if (j >= 0)
								m_isThisCall = caller.Instructions.LoadsThisArg(j);
						}
					}
				}
			}
			return m_isThisCall.Value;
		}
开发者ID:dbremner,项目名称:smokey,代码行数:37,代码来源:Call.cs


示例3: DoCallsVirtual

		private int DoCallsVirtual(AssemblyCache cache, MethodInfo info)
		{
			int offset = -1;
			if (m_tested.IndexOf(info.Method.ToString()) >= 0)
				return offset;
				
			m_tested.Add(info.Method.ToString());

			Log.DebugLine(this, "checking:");
			Log.Indent();
			
			// If the class isn't sealed then,
			if (info.Method.Body != null && info.Instructions != null)
			{
				Log.DebugLine(this, "{0:F}", info.Instructions);

				// loop through every instruction,
				for (int i = 0; i < info.Instructions.Length && offset < 0; ++i)
				{
					// if it's a call,
					Call call = info.Instructions[i] as Call;
					if (call != null)
					{	
						// then we have a problem if we're calling a virtual method
						// on our instance,
						MethodInfo targetInfo = cache.FindMethod(call.Target);
						if (targetInfo != null)
						{
							if (call.IsThisCall(Cache, info, i))
							{
								if (targetInfo.Method.IsVirtual && !targetInfo.Method.IsFinal)
								{
									Log.DebugLine(this, "{0} is virtual", call.Target);
									{
										m_details = call.Target.ToString();			
										offset = call.Untyped.Offset;
										Log.DebugLine(this, "found virtual call at {0:X2}", offset);
									}
								}
								else
								{
									// or we're calling one of our methods which calls a virtual method
									// on our instance.
									offset = DoCallsVirtual(cache, targetInfo);
								}
							}
						}
					}
				}
			}
			Log.Unindent();
			
			if (offset >= 0)
				m_details = info.Method + " -> " + Environment.NewLine + "       " + m_details;			
			
			return offset;
		}
开发者ID:dbremner,项目名称:smokey,代码行数:57,代码来源:CtorCallsVirtualRule.cs


示例4: DoGetStructSize

		// There doesn't seem to be a way to get this via Cecil: all of the obvious
		// candidates like TypeDefinition::PackingSize, TypeDefinition::ClassSize,
		// and FieldDefinition::Offset return zero.
		private int DoGetStructSize(AssemblyCache cache, TypeDefinition type, int level)
		{
			int size = 0;
			DBC.Assert(level < 100, "LargeStructRule didn't terminate for type {0}", type.FullName);
//			Console.WriteLine(prefix + type.FullName);
			
			// For each field,
			foreach (FieldDefinition field in type.Fields)
			{
				Log.WarningLine(this, "checking field of type {0}{1}", new string(' ', 3*level), field.FieldType.FullName);
				
				// if it isn't static,
				if (!field.IsStatic)
				{
					// if it's a value type,
					if (field.FieldType.IsValueType)
					{
						// if it's a standard system struct then we know the size,
						int temp = DoGetSystemTypeSize(field.FieldType.FullName);
						if (temp > 0)
							size += temp;
						else 
						{
							// otherwise if it's one of our types we can figure the
							// size out,
							TypeDefinition t = cache.FindType(field.FieldType);
							if (t != null && t.FullName != type.FullName)	// TODO: shouldn't need the name check (but mscorlib.dll infinitely recurses w/o it)
							{
								if (t.IsEnum || !t.IsValueType)
									size += 4;
								else
									size += DoGetStructSize(cache, t, level + 1);
							}
							
							// if it's not one of our types then we appear to be hosed
							// (this should rarely happen now that we load dependant
							// assemblies).
							else
							{
								Log.TraceLine(this, "couldn't find the size for {0}", field.FieldType.FullName);
								size += 1;		
							}
						}
					}
					
					// if it's not a value type then for our purposes its size is 4 
					// (pointers may be 8 bytes on a 64-bit platform but we don't want
					// to report errors just because they happen to be running on a 
					// 64-bit system).
					else
						size += 4;
				}
			}
						
			return size;
		}
开发者ID:dbremner,项目名称:smokey,代码行数:59,代码来源:LargeStructRule.cs


示例5: MakeTest

 protected ComparisonTest MakeTest (
     string filename, string[] stubbedAssemblies = null,
     TypeInfoProvider typeInfo = null,
     AssemblyCache assemblyCache = null
 ) {
     return new ComparisonTest(
         EvaluatorPool,
         Portability.NormalizeDirectorySeparators(filename), stubbedAssemblies,
         typeInfo, assemblyCache
     );
 }
开发者ID:cbsistem,项目名称:JSIL,代码行数:11,代码来源:GenericTestFixture.cs


示例6: Rule

		protected Rule(AssemblyCache cache, IReportViolations reporter, string checkID)
		{
			DBC.Pre(cache != null, "cache is null");
			DBC.Pre(reporter != null, "reporter is null");
			DBC.Pre(!string.IsNullOrEmpty(checkID), "checkID is null or empty");

			Cache = cache;
			Reporter = reporter;
			CheckID = checkID;
			Runtime = TargetRuntime.NET_1_0;
		}
开发者ID:dbremner,项目名称:smokey,代码行数:11,代码来源:Rule.cs


示例7: UseFlagsAttributeRule

		public UseFlagsAttributeRule(AssemblyCache cache, IReportViolations reporter) 
			: base(cache, reporter, "D1019")
		{
			long mask = 1;
			for (int i = 0; i < 63; ++i)
			{
				m_powers.Add(mask);
				mask = mask << 1;
			}
			m_powers.Add(mask);
		}
开发者ID:dbremner,项目名称:smokey,代码行数:11,代码来源:UseFlagsAttributeRule.cs


示例8: ComparisonTest

        public ComparisonTest(
            EvaluatorPool pool,
            IEnumerable<string> filenames, string outputPath, 
            string[] stubbedAssemblies = null, TypeInfoProvider typeInfo = null,
            AssemblyCache assemblyCache = null
        )
        {
            var started = DateTime.UtcNow.Ticks;
            OutputPath = outputPath;
            EvaluatorPool = pool;

            var extensions = (from f in filenames select Path.GetExtension(f).ToLower()).Distinct().ToArray();
            var absoluteFilenames = (from f in filenames select Path.Combine(TestSourceFolder, f));

            if (extensions.Length != 1)
                throw new InvalidOperationException("Mixture of different source languages provided.");

            var assemblyNamePrefix = Path.GetDirectoryName(outputPath).Split(new char[] { '\\', '/' }).Last();
            var assemblyName = Path.Combine(
                assemblyNamePrefix,
                Path.GetFileName(outputPath).Replace(".js", "")
            );

            switch (extensions[0]) {
                case ".cs":
                    Assembly = CompilerUtil.CompileCS(absoluteFilenames, assemblyName);
                    break;
                case ".vb":
                    Assembly = CompilerUtil.CompileVB(absoluteFilenames, assemblyName);
                    break;
                case ".exe":
                case ".dll":
                    var fns = absoluteFilenames.ToArray();
                    if (fns.Length > 1)
                        throw new InvalidOperationException("Multiple binary assemblies provided.");

                    Assembly = Assembly.LoadFile(fns[0]);
                    break;
                default:
                    throw new ArgumentException("Unsupported source file type for test");
            }

            if (typeInfo != null)
                typeInfo.ClearCaches();

            StubbedAssemblies = stubbedAssemblies;
            TypeInfo = typeInfo;
            AssemblyCache = assemblyCache;

            var ended = DateTime.UtcNow.Ticks;
            CompilationElapsed = TimeSpan.FromTicks(ended - started);
        }
开发者ID:xen2,项目名称:JSIL,代码行数:52,代码来源:TestUtil.cs


示例9: NonLocalizedGuiRule

		public NonLocalizedGuiRule(AssemblyCache cache, IReportViolations reporter) 
			: base(cache, reporter, "G1002")
		{
			m_enabled = Settings.Get("*localized*", "true") == "true";
			Log.TraceLine(this, "enabled: {0}", m_enabled);
			
			string custom = Settings.Get("localize", string.Empty);
			foreach (string name in custom.Split(';'))
			{
				Log.TraceLine(this, "using custom: {0}", name);
				m_custom.Add(" " + name + "(");		// add some goo so we match only what we should
			}
		}
开发者ID:dbremner,项目名称:smokey,代码行数:13,代码来源:NonLocalizedGuiRule.cs


示例10: OperatorAlternativeRule

		public OperatorAlternativeRule(AssemblyCache cache, IReportViolations reporter) 
			: base(cache, reporter, "D1033")
		{
			m_table.Add("op_Addition", "Add");
			m_table.Add("op_Subtraction", "Subtract");
			m_table.Add("op_Multiply", "Multiply");
			m_table.Add("op_Division", "Divide");
			m_table.Add("op_Modulus", "Mod");
			m_table.Add("op_GreaterThan", "Compare");
			m_table.Add("op_GreaterThanOrEqual", "Compare");
			m_table.Add("op_LessThan", "Compare");
			m_table.Add("op_LessThanOrEqual", "Compare");
			m_table.Add("op_Inequality", "Equals");
			m_table.Add("op_Equality", "Equals");
		}
开发者ID:dbremner,项目名称:smokey,代码行数:15,代码来源:OperatorAlternativeRule.cs


示例11: CreateTranslator

        static AssemblyTranslator CreateTranslator(
            Configuration configuration, AssemblyManifest manifest, AssemblyCache assemblyCache
        )
        {
            TypeInfoProvider typeInfoProvider = null;

            if (
                configuration.ReuseTypeInfoAcrossAssemblies.GetValueOrDefault(true) &&
                (CachedTypeInfoProvider != null)
            ) {
                if (CachedTypeInfoProviderConfiguration.Assemblies.Equals(configuration.Assemblies))
                    typeInfoProvider = CachedTypeInfoProvider;
            }

            var translator = new AssemblyTranslator(
                configuration, typeInfoProvider, manifest, assemblyCache,
                onProxyAssemblyLoaded: (name) => {
                    Console.Error.WriteLine("// Loaded proxies from '{0}'", ShortenPath(name));
                }
            );

            translator.Decompiling += MakeProgressHandler       ("Decompiling ");
            translator.RunningTransforms += MakeProgressHandler ("Translating ");
            translator.Writing += MakeProgressHandler           ("Writing JS  ");

            translator.AssemblyLoaded += (fn) => {
                Console.Error.WriteLine("// Loaded {0}", ShortenPath(fn));
            };
            translator.CouldNotLoadSymbols += (fn, ex) => {
            };
            translator.CouldNotResolveAssembly += (fn, ex) => {
                Console.Error.WriteLine("// Could not load module {0}: {1}", fn, ex.Message);
            };
            translator.CouldNotDecompileMethod += (fn, ex) => {
                Console.Error.WriteLine("// Could not decompile method {0}: {1}", fn, ex.Message);
            };

            if (typeInfoProvider == null) {
                if (CachedTypeInfoProvider != null)
                    CachedTypeInfoProvider.Dispose();

                CachedTypeInfoProvider = translator.GetTypeInfoProvider();
                CachedTypeInfoProviderConfiguration = configuration;
            }

            return translator;
        }
开发者ID:simon-heinen,项目名称:JSIL,代码行数:47,代码来源:Program.cs


示例12: SpecialFolderRule

		public SpecialFolderRule(AssemblyCache cache, IReportViolations reporter) 
			: base(cache, reporter, "PO1003")
		{
			string user = Environment.UserName;
			
			Array values = Enum.GetValues(typeof(Environment.SpecialFolder));			
			foreach (object o in values)
			{
				Environment.SpecialFolder name = (Environment.SpecialFolder) o;
				string path = Environment.GetFolderPath(name);
				if (path.Length > 0)
				{
					path = path.Replace(user, "*");
					if (!m_globs.ContainsKey(name))
						m_globs.Add(name, path.Split(Path.DirectorySeparatorChar));
				}
			}
		}
开发者ID:dbremner,项目名称:smokey,代码行数:18,代码来源:SpecialFolderRule.cs


示例13: FilenameTestSource

        protected IEnumerable<TestCaseData> FilenameTestSource(string[] filenames, TypeInfoProvider typeInfo = null, AssemblyCache asmCache = null)
        {
            var testNames = filenames.OrderBy((s) => s).ToArray();

            for (int i = 0, l = testNames.Length; i < l; i++) {
                var testName = testNames[i];

                bool isIgnored = testName.StartsWith("ignored:", StringComparison.OrdinalIgnoreCase);
                var actualTestName = testName;

                if (isIgnored)
                    actualTestName = actualTestName.Substring(actualTestName.IndexOf(":") + 1);

                var item = (new TestCaseData(new object[] { new object[] { actualTestName, typeInfo, asmCache, null, i == (l - 1) } }))
                    .SetName(Path.GetFileName(actualTestName));

                if (isIgnored)
                    item.Ignore();

                yield return item;
            }
        }
开发者ID:Ocelloid,项目名称:JSIL,代码行数:22,代码来源:GenericTestFixture.cs


示例14: CreateTranslator

        static AssemblyTranslator CreateTranslator(Configuration configuration, AssemblyManifest manifest, AssemblyCache assemblyCache)
        {
            var translator = new AssemblyTranslator(configuration, null, manifest, assemblyCache);

            translator.Decompiling += MakeProgressHandler("Decompiling   ");
            translator.Optimizing += MakeProgressHandler ("Optimizing    ");
            translator.Writing += MakeProgressHandler    ("Generating JS ");

            translator.AssemblyLoaded += (fn) => {
                Console.Error.WriteLine("// Loaded {0}", ShortenPath(fn));
            };
            translator.CouldNotLoadSymbols += (fn, ex) => {
            };
            translator.CouldNotResolveAssembly += (fn, ex) => {
                Console.Error.WriteLine("// Could not load module {0}: {1}", fn, ex.Message);
            };
            translator.CouldNotDecompileMethod += (fn, ex) => {
                Console.Error.WriteLine("// Could not decompile method {0}: {1}", fn, ex.Message);
            };

            return translator;
        }
开发者ID:c444b774,项目名称:JSIL,代码行数:22,代码来源:Program.cs


示例15: NoStaticRemoveRule

		public NoStaticRemoveRule(AssemblyCache cache, IReportViolations reporter) 
			: base(cache, reporter, "C1026")
		{
			// Collections.Generic
			m_adders.Add  ("System.Collections.Generic.Dictionary`", new List<string>{"Add", "set_Item"});
			m_removers.Add("System.Collections.Generic.Dictionary`", new List<string>{"Clear", "Remove"});
			
			m_adders.Add  ("System.Collections.Generic.HashSet`", new List<string>{"Add", "UnionWith"});
			m_removers.Add("System.Collections.Generic.HashSet`", new List<string>{"Clear", "ExceptWith", "IntersectWith", "Remove", "RemoveWhere", "SymmetricExceptWith"});
			
			m_adders.Add  ("System.Collections.Generic.List`", new List<string>{"Add", "AddRange", "Insert", "InsertRange"});
			m_removers.Add("System.Collections.Generic.List`", new List<string>{"Clear", "Remove", "RemoveAll", "RemoveAt", "RemoveRange"});
			
			m_adders.Add  ("System.Collections.Generic.Queue`", new List<string>{"Enqueue"});
			m_removers.Add("System.Collections.Generic.Queue`", new List<string>{"Clear", "Dequeue"});
			
			m_adders.Add  ("System.Collections.Generic.SortedDictionary`", new List<string>{"Add", "set_Item"});
			m_removers.Add("System.Collections.Generic.SortedDictionary`", new List<string>{"Clear", "Remove"});
			
			m_adders.Add  ("System.Collections.Generic.Stack`", new List<string>{"Push"});
			m_removers.Add("System.Collections.Generic.Stack`", new List<string>{"Clear", "Pop"});
			
			// Collections
			m_adders.Add  ("System.Collections.ArrayList", new List<string>{"Add", "AddRange", "Insert", "InsertRange"});
			m_removers.Add("System.Collections.ArrayList", new List<string>{"Clear", "Remove", "RemoveAt", "RemoveRange"});
			
			m_adders.Add  ("System.Collections.Hashtable", new List<string>{"Add", "set_Item"});
			m_removers.Add("System.Collections.Hashtable", new List<string>{"Clear", "Remove"});
			
			m_adders.Add  ("System.Collections.Queue", new List<string>{"Enqueue"});
			m_removers.Add("System.Collections.Queue", new List<string>{"Clear", "Dequeue"});
			
			m_adders.Add  ("System.Collections.SortedList", new List<string>{"Add", "set_Item"});
			m_removers.Add("System.Collections.SortedList", new List<string>{"Clear", "Remove", "RemoveAt"});
			
		}
开发者ID:dbremner,项目名称:smokey,代码行数:36,代码来源:NoStaticRemoveRule.cs


示例16: OnCreate

 protected override Rule OnCreate(AssemblyCache cache, IReportViolations reporter)
 {
     return new IntegerOverflowRule(cache, reporter);
 }
开发者ID:dbremner,项目名称:smokey,代码行数:4,代码来源:IntegerOverflowTest.cs


示例17: RunComparisonTest

        private CompileResult RunComparisonTest(
            string filename, string[] stubbedAssemblies = null, TypeInfoProvider typeInfo = null, Action<string, string> errorCheckPredicate = null,
            List<string> failureList = null, string commonFile = null, bool shouldRunJs = true, AssemblyCache asmCache = null,
            Func<Configuration> makeConfiguration = null, Action<Exception> onTranslationFailure = null,
            string compilerOptions = ""
        )
        {
            CompileResult result = null;
            Console.WriteLine("// {0} ... ", Path.GetFileName(filename));
            filename = Portability.NormalizeDirectorySeparators(filename);

            try {
                var testFilenames = new List<string>() { filename };
                if (commonFile != null)
                    testFilenames.Add(commonFile);

                using (var test = new ComparisonTest(
                    EvaluatorPool,
                    testFilenames,
                    Path.Combine(
                        ComparisonTest.TestSourceFolder,
                        ComparisonTest.MapSourceFileToTestFile(filename)
                    ),
                    stubbedAssemblies, typeInfo, asmCache,
                    compilerOptions: compilerOptions
                )) {
                    result = test.CompileResult;

                    if (shouldRunJs) {
                        test.Run(makeConfiguration: makeConfiguration, onTranslationFailure: onTranslationFailure);
                    } else {
                        string js;
                        long elapsed;
                        try {
                            var csOutput = test.RunCSharp(new string[0], out elapsed);
                            test.GenerateJavascript(new string[0], out js, out elapsed, makeConfiguration, onTranslationFailure);

                            Console.WriteLine("generated");

                            if (errorCheckPredicate != null) {
                                errorCheckPredicate(csOutput, js);
                            }
                        } catch (Exception) {
                            Console.WriteLine("error");
                            throw;
                        }
                    }
                }
            } catch (Exception ex) {
                if (ex.Message == "JS test failed")
                    Debug.WriteLine(ex.InnerException);
                else
                    Debug.WriteLine(ex);

                if (failureList != null) {
                    failureList.Add(Path.GetFileNameWithoutExtension(filename));
                } else
                    throw;
            }

            return result;
        }
开发者ID:poizan42,项目名称:JSIL,代码行数:62,代码来源:GenericTestFixture.cs


示例18: RunComparisonTests

        /// <summary>
        /// Runs one or more comparison tests by compiling the source C# or VB.net file,
        ///     running the compiled test method, translating the compiled test method to JS,
        ///     then running the translated JS and comparing the outputs.
        /// </summary>
        /// <param name="filenames">The path to one or more test files. If a test file is named 'Common.cs' it will be linked into all tests.</param>
        /// <param name="stubbedAssemblies">The paths of assemblies to stub during translation, if any.</param>
        /// <param name="typeInfo">A TypeInfoProvider to use for type info. Using this parameter is not advised if you use proxies or JSIL.Meta attributes in your tests.</param>
        /// <param name="testPredicate">A predicate to invoke before running each test. If the predicate returns false, the JS version of the test will not be run (though it will be translated).</param>
        protected void RunComparisonTests(
            string[] filenames, string[] stubbedAssemblies = null,
            TypeInfoProvider typeInfo = null,
            Func<string, bool> testPredicate = null,
            Action<string, string> errorCheckPredicate = null,
            Func<Configuration> getConfiguration = null
        )
        {
            var started = DateTime.UtcNow.Ticks;

            string commonFile = null;
            for (var i = 0; i < filenames.Length; i++) {
                if (filenames[i].Contains(Path.Combine ("", "Common."))) {
                    commonFile = filenames[i];
                    break;
                }
            }

            const string keyName = @"Software\Squared\JSIL\Tests\PreviousFailures";

            StackFrame callingTest = null;
            for (int i = 1; i < 10; i++) {
                callingTest = new StackFrame(i);
                var method = callingTest.GetMethod();
                if ((method != null) && method.GetCustomAttributes(true).Any(
                    (ca) => ca.GetType().FullName == "NUnit.Framework.TestAttribute"
                )) {
                    break;
                } else {
                    callingTest = null;
                }
            }

            var previousFailures = new HashSet<string>();
            MethodBase callingMethod = null;
            if ((callingTest != null) && ((callingMethod = callingTest.GetMethod()) != null)) {
                try {
                    using (var rk = Registry.CurrentUser.CreateSubKey(keyName)) {
                        var names = rk.GetValue(callingMethod.Name) as string;
                        if (names != null) {
                            foreach (var name in names.Split(',')) {
                                previousFailures.Add(name);
                            }
                        }
                    }
                } catch (Exception ex) {
                    Console.WriteLine("Warning: Could not open registry key: {0}", ex);
                }
            }

            var failureList = new List<string>();
            var sortedFilenames = new List<string>(filenames);
            sortedFilenames.Sort(
                (lhs, rhs) => {
                    var lhsShort = Path.GetFileNameWithoutExtension(lhs);
                    var rhsShort = Path.GetFileNameWithoutExtension(rhs);

                    int result =
                        (previousFailures.Contains(lhsShort) ? 0 : 1).CompareTo(
                            previousFailures.Contains(rhsShort) ? 0 : 1
                        );

                    if (result == 0)
                        result = lhsShort.CompareTo(rhsShort);

                    return result;
                }
            );

            var asmCache = new AssemblyCache();

            foreach (var filename in sortedFilenames) {
                if (filename == commonFile)
                    continue;

                bool shouldRunJs = true;
                if (testPredicate != null)
                    shouldRunJs = testPredicate(filename);

                RunComparisonTest(
                    filename, stubbedAssemblies, typeInfo,
                    errorCheckPredicate, failureList,
                    commonFile, shouldRunJs, asmCache,
                    getConfiguration ?? MakeConfiguration
                );
            }

            if (callingMethod != null) {
                try {
                    using (var rk = Registry.CurrentUser.CreateSubKey(keyName))
                        rk.SetValue(callingMethod.Name, String.Join(",", failureList.ToArray()));
//.........这里部分代码省略.........
开发者ID:poizan42,项目名称:JSIL,代码行数:101,代码来源:GenericTestFixture.cs


示例19: FolderTestSource

        protected IEnumerable<TestCaseData> FolderTestSource(string folderName, TypeInfoProvider typeInfo = null, AssemblyCache asmCache = null)
        {
            var testPath = Path.GetFullPath(Path.Combine(ComparisonTest.TestSourceFolder, folderName));
            var testNames = Directory.GetFiles(testPath, "*.cs")
                .Concat(Directory.GetFiles(testPath, "*.vb"))
                .Concat(Directory.GetFiles(testPath, "*.fs"))
                .OrderBy((s) => s).ToArray();

            string commonFile = null;

            foreach (var testName in testNames) {
                if (Path.GetFileNameWithoutExtension(testName) == "Common") {
                    commonFile = testName;
                    break;
                }
            }

            for (int i = 0, l = testNames.Length; i < l; i++) {
                var testName = testNames[i];
                if (Path.GetFileNameWithoutExtension(testName) == "Common")
                    continue;

                yield return (new TestCaseData(new object[] { new object[] { testName, typeInfo, asmCache, commonFile, i == (l - 1) } }))
                    .SetName(PickTestNameForFilename(testName))
                    .SetDescription(String.Format("{0}\\{1}", folderName, Path.GetFileName(testName)))
                    .SetCategory(folderName);
            }
        }
开发者ID:poizan42,项目名称:JSIL,代码行数:28,代码来源:GenericTestFixture.cs


示例20: OnCreate

 protected override Rule OnCreate(AssemblyCache cache, IReportViolations reporter)
 {
     return new EventHandlerRule(cache, reporter);
 }
开发者ID:dbremner,项目名称:smokey,代码行数:4,代码来源:EventHandlerTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AssemblyCompiler类代码示例发布时间:2022-05-24
下一篇:
C# AssemblyBuilderAccess类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap