예제 #1
0
        public void ResolveFullDomainGenericJobsTest()
        {
            var assemblyPaths = CompilationPipeline.GetAssemblies(AssembliesType.Player)
                                .Select(a => a.outputPath);
            var jobResolver  = new GenericResolver(assemblyPaths);
            var resolvedJobs = jobResolver.ResolveGenericJobs();

            jobResolver.Dispose();
        }
예제 #2
0
        public void ResolveGenericJobsTest()
        {
            var assemblyPaths = CecilTypeUtility.GetAssemblyPaths(new[] { "Stackray.TestGenericJobs.dll" });
            var jobResolver   = new GenericResolver(assemblyPaths);
            var resolvedJobs  = jobResolver.ResolveGenericJobs();

            jobResolver.Dispose();
            Assert.True(resolvedJobs.Count() == GenericJobs <bool, bool> .CONCRETE_UNIQUE_JOB_ENTRIES);
        }
예제 #3
0
        public void GetGenericJobsCallsTest()
        {
            var assemblyPaths = CecilTypeUtility.GetAssemblyPaths(new[] { "Stackray.TestGenericJobs.dll" });
            var jobResolver   = new GenericResolver(assemblyPaths);
            var genericJobs   = jobResolver.GetGenericJobCalls();

            jobResolver.Dispose();
            Assert.True(genericJobs.Count() == GenericJobs <bool, bool> .GENERIC_UNIQUE_JOB_ENTRIES);
        }
예제 #4
0
        public void ResolveGenericCascadeCallTest()
        {
            var assemblyPaths = CecilTypeUtility.GetAssemblyPaths(new[] { "Stackray.TestGenericCascadeCall.dll" });
            var jobResolver   = new GenericResolver(assemblyPaths);
            var resolvedJobs  = jobResolver.ResolveGenericJobs();

            jobResolver.Dispose();
            Assert.True(
                resolvedJobs.Count() == 1 &&
                (resolvedJobs.First() as GenericInstanceType).GenericArguments.Count == 1 &&
                (resolvedJobs.First() as GenericInstanceType).GenericArguments.First().Name == typeof(int).Name);
        }
예제 #5
0
        public void ResolveGenericSystemsTest()
        {
            var assemblyPaths = CecilTypeUtility.GetAssemblyPaths(new[] { "Stackray.TestGenericSystems.dll" });
            var jobResolver   = new GenericResolver(assemblyPaths);
            var resolvedJobs  = jobResolver.ResolveGenericJobs();

            jobResolver.Dispose();
            Assert.True(
                resolvedJobs.Count() == 2 &&
                resolvedJobs.Any(job => (job as GenericInstanceType).GenericArguments.First().Name == typeof(int).Name) &&
                resolvedJobs.Any(job => (job as GenericInstanceType).GenericArguments.First().Name == typeof(double).Name));
        }
예제 #6
0
        public void WriteNewAssemblyInjectionTest()
        {
            var writeAssemblyPath = AssembliesPath + "TestConcreteAssembly.dll";
            var assemblyPaths     = CecilTypeUtility.GetAssemblyPaths(new[] { "Stackray.TestGenericJobs.dll" });
            var jobResolver       = new GenericResolver(assemblyPaths);
            var resolvedJobs      = jobResolver.ResolveGenericJobs();

            jobResolver.Dispose();
            var outputAssembly = CecilTypeUtility.CreateAssembly("TestConcreteJobs", resolvedJobs);

            outputAssembly.Write(writeAssemblyPath);

            var assembly = AssemblyDefinition.ReadAssembly(writeAssemblyPath);
            var methods  = CecilTypeUtility.GetMethodDefinitions(assembly).Where(m => m.FullName.Contains("TestConcreteJobs"));

            assembly.Dispose();
            Assert.True(methods.Any());
        }