public void ShouldLoadFilesEvenIfDynamicAssemblyExists()
        {
            CompilerHelper.CleanUpDirectory(@".\CompileOutput\");
            CompilerHelper.CleanUpDirectory(@".\IgnoreDynamicGeneratedFilesTestDir\");
            CompilerHelper.CompileFile(@"Prism.Wpf.Tests.Mocks.Modules.MockAttributedModule.cs",
                                       @".\IgnoreDynamicGeneratedFilesTestDir\MockAttributedModule.dll");

            string path = @".\IgnoreDynamicGeneratedFilesTestDir";

            AppDomain testDomain = null;

            try
            {
                testDomain = CreateAppDomain();
                RemoteDirectoryLookupCatalog remoteEnum = CreateRemoteDirectoryModuleCatalogInAppDomain(testDomain);

                remoteEnum.LoadDynamicEmittedModule();

                ModuleInfo[] infos = remoteEnum.DoEnumeration(path);

                Assert.IsNotNull(
                    infos.FirstOrDefault(x => x.ModuleType.IndexOf("Prism.Wpf.Tests.Mocks.Modules.MockAttributedModule") >= 0)
                    );
            }
            finally
            {
                if (testDomain != null)
                {
                    AppDomain.Unload(testDomain);
                }
            }
        }
        public void ShouldResolvePartialAssemblyName()
        {
            string assemblyPath = CompilerHelper.GenerateDynamicModule("ModuleInLoadedFromContext2", "Module", ModulesDirectory1 + @"\ModuleInLoadedFromContext2.dll");
            var    uriBuilder   = new UriBuilder
            {
                Host   = String.Empty,
                Scheme = Uri.UriSchemeFile,
                Path   = Path.GetFullPath(assemblyPath)
            };
            var assemblyUri = uriBuilder.Uri;

            using (var resolver = new AssemblyResolver())
            {
                resolver.LoadAssemblyFrom(assemblyUri.ToString());

                Type resolvedType =
                    Type.GetType("TestModules.ModuleInLoadedFromContext2Class, ModuleInLoadedFromContext2");

                Assert.NotNull(resolvedType);

                resolvedType =
                    Type.GetType("TestModules.ModuleInLoadedFromContext2Class, ModuleInLoadedFromContext2, Version=0.0.0.0");

                Assert.NotNull(resolvedType);

                resolvedType =
                    Type.GetType("TestModules.ModuleInLoadedFromContext2Class, ModuleInLoadedFromContext2, Version=0.0.0.0, Culture=neutral");

                Assert.NotNull(resolvedType);
            }
        }
        public void ShouldCorrectlyEscapeRef()
        {
            string assemblyPath = ModulesDirectory6 + @"\Mock Module #.dll";

            CompilerHelper.CompileFile(@"Prism.Wpf.Tests.Mocks.Modules.MockModuleA.cs", assemblyPath);
            string fullAssemblyPath = Path.GetFullPath(assemblyPath);

            DirectoryModuleCatalog catalog = new DirectoryModuleCatalog();

            catalog.ModulePath = ModulesDirectory6;
            catalog.Load();

            ModuleInfo[] modules = catalog.Modules.ToArray();

            Assert.IsNotNull(modules);
            Assert.AreEqual(1, modules.Length);
            Assert.IsNotNull(modules[0].Ref);

            string moduleRef = modules[0].Ref;
            Uri    moduleUri; // = new Uri(moduleRef);

            Assert.IsTrue(Uri.TryCreate(moduleRef, UriKind.Absolute, out moduleUri));

            Assert.AreEqual(fullAssemblyPath, moduleUri.LocalPath);
        }
        public void ShouldLoadFilesEvenIfDynamicAssemblyExists()
        {
            CompilerHelper.CleanUpDirectory(@".\CompileOutput\");
            CompilerHelper.CleanUpDirectory(@".\IgnoreDynamicGeneratedFilesTestDir\");
            CompilerHelper.CompileFile(@"Microsoft.Practices.Composite.Tests.Mocks.Modules.MockAttributedModule.cs",
                                       @".\IgnoreDynamicGeneratedFilesTestDir\MockAttributedModule.dll");

            string path = @".\IgnoreDynamicGeneratedFilesTestDir";

            AppDomain testDomain = null;

            try
            {
                testDomain = CreateAppDomain();
                RemoteEnumerator remoteEnum = CreateRemoteEnumeratorInAppdomain(testDomain);

                remoteEnum.LoadDynamicEmittedModule();

                ModuleInfo[] infos = remoteEnum.DoEnumeration(path);

                Assert.IsNotNull(
                    infos.FirstOrDefault(x => x.ModuleType == "Microsoft.Practices.Composite.Tests.Mocks.Modules.MockAttributedModule")
                    );
            }
            finally
            {
                if (testDomain != null)
                {
                    AppDomain.Unload(testDomain);
                }
            }
        }
        public void ShouldGetDependantModulesFromAttribute()
        {
            string path = @".\DependantModules";

            CompilerHelper.CleanUpDirectory(path);
            CompilerHelper.CompileFile(@"Microsoft.Practices.Composite.Tests.Mocks.Modules.MockDependencyModule.cs",
                                       @".\DependantModules\DependencyModule.dll");

            CompilerHelper.CompileFile(@"Microsoft.Practices.Composite.Tests.Mocks.Modules.MockDependantModule.cs",
                                       @".\DependantModules\DependantModule.dll");


            IModuleEnumerator enumerator = new DirectoryLookupModuleEnumerator(path);

            ModuleInfo[] modules = enumerator.GetModules();

            Assert.AreEqual(2, modules.Length);
            var dependantModule  = modules.First(module => module.ModuleName == "DependantModule");
            var dependencyModule = modules.First(module => module.ModuleName == "DependencyModule");

            Assert.IsNotNull(dependantModule);
            Assert.IsNotNull(dependencyModule);
            Assert.IsNotNull(dependantModule.DependsOn);
            Assert.AreEqual(1, dependantModule.DependsOn.Count);
            Assert.AreEqual(dependencyModule.ModuleName, dependantModule.DependsOn[0]);
        }
        public void ShouldResolveTypeFromAbsoluteUriToAssembly()
        {
            string assemblyPath = CompilerHelper.GenerateDynamicModule("ModuleInLoadedFromContext1", "Module", ModulesDirectory1 + @"\ModuleInLoadedFromContext1.dll");
            var    uriBuilder   = new UriBuilder
            {
                Host   = String.Empty,
                Scheme = Uri.UriSchemeFile,
                Path   = Path.GetFullPath(assemblyPath)
            };
            var assemblyUri = uriBuilder.Uri;

            using (var resolver = new AssemblyResolver())
            {
                Type resolvedType =
                    Type.GetType(
                        "TestModules.ModuleInLoadedFromContext1Class, ModuleInLoadedFromContext1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
                Assert.IsNull(resolvedType);

                resolver.LoadAssemblyFrom(assemblyUri.ToString());

                resolvedType =
                    Type.GetType(
                        "TestModules.ModuleInLoadedFromContext1Class, ModuleInLoadedFromContext1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
                Assert.IsNotNull(resolvedType);
            }
        }
Пример #7
0
        private bool GetNewHost()
        {
            bool     blnResult = false;
            Assembly assembly  = null;

            assembly = CompilerHelper.CompileCSharp(editForm, CSharpCode);

            if (assembly != null)
            {
                if (SecondLifeHost != null)
                {
                    SecondLifeHost.Dispose();
                }
                SecondLifeHost = null;

                SecondLifeHost                          = new SecondLifeHost(this.mainForm, assembly, editForm.FullPathName, editForm.guid);
                SecondLifeHost.OnChat                  += editForm.ChatHandler;
                SecondLifeHost.OnMessageLinked         += editForm.MessageLinkedHandler;
                SecondLifeHost.OnDie                   += new EventHandler(host_OnDie);
                SecondLifeHost.OnReset                 += new EventHandler(SecondLifeHost_OnReset);
                SecondLifeHost.OnListenChannelsChanged += new EventHandler(SecondLifeHost_OnListenChannelsChanged);

                SecondLifeHost.OnVerboseMessage += new SecondLifeHost.SecondLifeHostMessageHandler(host_OnVerboseMessage);
                SecondLifeHost.OnStateChange    += new SecondLifeHost.SecondLifeHostMessageHandler(host_OnStateChange);

                SecondLifeHost.State("default", true);

                blnResult = true;
            }
            return(blnResult);
        }
Пример #8
0
        /// <summary>
        /// <see cref="ScriptExecutorBase.OnExecute(string, ScriptExecutionResult)" />
        /// </summary>
        protected override void OnExecute(string src, ScriptExecutionResult result)
        {
            var compiler = new CSharpCodeProvider();

            CompilerParameters compilerParams;
            IList <string>     namespaces;

            CompilerHelper.CreateDataForCompiler(out compilerParams,
                                                 out namespaces);

            string typeName;
            var    compilerResult = compiler.CompileAssemblyFromSource(compilerParams,
                                                                       this.CreateFullSourceCode(src, namespaces, out typeName));

            if (compilerResult.Errors.HasErrors == false)
            {
                var type = compilerResult.CompiledAssembly
                           .GetTypes()
                           .Single(x => x.FullName == typeName);

                var env = (global::MarcelJoachimKloubert.ScriptTHOR.Scripting.ScriptExecutionEnvironmentBase)Activator.CreateInstance(type);

                var ctx = new ScriptExecutionContext();
                env.Execute(ctx);
            }
            else
            {
            }
        }
        public void ShouldIgnoreAbstractClassesThatImplementIModule()
        {
            CompilerHelper.CleanUpDirectory(ModulesDirectory1);
            CompilerHelper.CompileFile(@"Prism.Wpf.Tests.Mocks.Modules.MockAbstractModule.cs",
                                       ModulesDirectory1 + @"\MockAbstractModule.dll");

            string filename            = typeof(DirectoryModuleCatalog).Assembly.Location;
            string destinationFileName = Path.Combine(ModulesDirectory1, Path.GetFileName(filename));

            File.Copy(filename, destinationFileName);

            DirectoryModuleCatalog catalog = new DirectoryModuleCatalog
            {
                ModulePath = ModulesDirectory1
            };

            catalog.Load();

            var modules = catalog.Modules.ToArray();

            Assert.Single(modules);
            Assert.Equal("MockInheritingModule", modules[0].ModuleName);

            CompilerHelper.CleanUpDirectory(ModulesDirectory1);
        }
Пример #10
0
        public bool SyntaxCheck()
        {
            bool blnResult = false;

            //if (this.disableCompilesyntaxCheckToolStripMenuItem.Checked)
            //	return false;

            if (this.IsScript)
            {
                LSL2CSharp translator = new LSL2CSharp(ConfLSL);
                string     strCSharp  = translator.Parse(SourceCode);

                if (System.Diagnostics.Debugger.IsAttached)
                {
                    for (int intI = this.tabControl1.TabPages.Count - 1; intI > 0; intI--)
                    {
                        this.tabControl1.TabPages.RemoveAt(intI);
                    }

                    // TODO
                    TabPage tabPage = new TabPage("C#");
                    NumberedTextBox.NumberedTextBoxUC numberedTextBoxUC1 = new NumberedTextBox.NumberedTextBoxUC();
                    numberedTextBoxUC1.TextBox.Init(null, this.ConfCSharp);
                    numberedTextBoxUC1.TextBox.Text     = strCSharp;
                    numberedTextBoxUC1.TextBox.ReadOnly = true;
                    numberedTextBoxUC1.Dock             = DockStyle.Fill;
                    tabPage.Controls.Add(numberedTextBoxUC1);
                    this.tabControl.TabPages.Add(tabPage);
                }
                blnResult = (null != CompilerHelper.CompileCSharp(this, strCSharp));
            }
            return(blnResult);
        }
        public void ShouldGetDependantModulesFromAttribute()
        {
            CompilerHelper.CompileFile(@"Prism.Wpf.Tests.Mocks.Modules.MockDependencyModule.cs",
                                       ModulesDirectory3 + @"\DependencyModule.dll");

            CompilerHelper.CompileFile(@"Prism.Wpf.Tests.Mocks.Modules.MockDependantModule.cs",
                                       ModulesDirectory3 + @"\DependantModule.dll");

            DirectoryModuleCatalog catalog = new DirectoryModuleCatalog();

            catalog.ModulePath = ModulesDirectory3;
            catalog.Load();

            ModuleInfo[] modules = catalog.Modules.ToArray();

            Assert.AreEqual(2, modules.Length);
            var dependantModule  = modules.First(module => module.ModuleName == "DependantModule");
            var dependencyModule = modules.First(module => module.ModuleName == "DependencyModule");

            Assert.IsNotNull(dependantModule);
            Assert.IsNotNull(dependencyModule);
            Assert.IsNotNull(dependantModule.DependsOn);
            Assert.AreEqual(1, dependantModule.DependsOn.Count);
            Assert.AreEqual(dependencyModule.ModuleName, dependantModule.DependsOn[0]);
        }
        public void LoadsValidAssembliesWhenInvalidDllsArePresent()
        {
            CompilerHelper.CompileFile(@"Prism.Wpf.Tests.Mocks.Modules.MockModuleA.cs",
                                       InvalidModulesDirectory + @"\MockModuleA.dll");

            DirectoryModuleCatalog catalog = new DirectoryModuleCatalog();

            catalog.ModulePath = InvalidModulesDirectory;
            try
            {
                catalog.Load();
            }
            catch (Exception)
            {
                Assert.Fail("Should not have thrown.");
            }

            ModuleInfo[] modules = catalog.Modules.ToArray();

            Assert.IsNotNull(modules);
            Assert.AreEqual(1, modules.Length);
            Assert.IsNotNull(modules[0].Ref);
            StringAssert.StartsWith(modules[0].Ref, "file://");
            Assert.IsTrue(modules[0].Ref.Contains(@"MockModuleA.dll"));
            Assert.IsNotNull(modules[0].ModuleType);
            StringAssert.Contains(modules[0].ModuleType, "Prism.Wpf.Tests.Mocks.Modules.MockModuleA");
        }
 public void CleanUpDirectories()
 {
     CompilerHelper.CleanUpDirectory(ModulesDirectory1);
     CompilerHelper.CleanUpDirectory(ModulesDirectory2);
     CompilerHelper.CleanUpDirectory(ModulesDirectory3);
     CompilerHelper.CleanUpDirectory(ModulesDirectory4);
     CompilerHelper.CleanUpDirectory(ModulesDirectory5);
 }
        public void CanInitDirectoryLookupModuleEnumerator()
        {
            string path = @".\MocksModules";

            CompilerHelper.CleanUpDirectory(path);
            IModuleEnumerator enumerator = new DirectoryLookupModuleEnumerator(path);

            Assert.IsNotNull(enumerator);
        }
Пример #15
0
        public void FailWhenDependingOnMissingModule()
        {
            string     assembly = CompilerHelper.GenerateDynamicModule("ModuleK", null, "ModuleL");
            ModuleInfo module   = new ModuleInfo(assembly, "ModuleK.TestsModules.ModuleKClass", "ModuleK", "ModuleL");

            ModuleLoader loader = new ModuleLoader(new MockContainerAdapter(), new MockLogger());

            loader.Initialize(new[] { module });
        }
 private void CleanUpDirectories()
 {
     CompilerHelper.CleanUpDirectory(ModulesDirectory1);
     CompilerHelper.CleanUpDirectory(ModulesDirectory2);
     CompilerHelper.CleanUpDirectory(ModulesDirectory3);
     CompilerHelper.CleanUpDirectory(ModulesDirectory4);
     CompilerHelper.CleanUpDirectory(ModulesDirectory5);
     CompilerHelper.CleanUpDirectory(InvalidModulesDirectory);
 }
        public IActionResult UploadTemplate(string projectid, [FromBody] CompileResourceRequest req)
        {
            try
            {
                if (req == null)
                {
                    return(BadRequest("Request object can not be null"));
                }

                req.ProjectId = projectid;

                var projectDetailsRequestModel = new GetProjectDetailsRequestModel
                {
                    ProjectId        = req.ProjectId,
                    ExcludeResources = false,
                    UserEmail        = req.UserEmail
                };

                var compileResult = CompilerHelper.CompileProjectResource(req);

                var compilerService   = new CompilerService();
                var updatePageRequest = new CreateOrUpdateResourceRequestModel
                {
                    Errors        = null,
                    FileContent   = req.FileContent,
                    SourcePath    = req.SourcePath.Trim(),
                    ClassName     = req.ClassName,
                    ProjectId     = req.ProjectId,
                    UserEmail     = req.UserEmail,
                    UrlPattern    = req.UrlPattern,
                    IsStatic      = req.IsStatic,
                    IsDefault     = req.IsDefault,
                    PageType      = req.PageType,
                    KObject       = req.KObject,
                    ResourceType  = null,
                    Configuration = !string.IsNullOrEmpty(req.Configuration) ? JsonConvert.DeserializeObject <Dictionary <string, object> >(req.Configuration) : null,
                };

                var validationResult = updatePageRequest.Validate();
                if (validationResult.Any())
                {
                    return(BadRequest(validationResult));
                }

                if (MongoConnector.CreateOrUpdateResource(updatePageRequest))
                {
                    return(Ok(compileResult));
                }

                return(BadRequest());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
Пример #18
0
        /// <summary>
        /// Cudafies the specified types. Working directory will be as per CudafyTranslator.WorkingDirectory.
        /// </summary>
        /// <param name="platform">The platform.</param>
        /// <param name="arch">The CUDA or OpenCL architecture.</param>
        /// <param name="cudaVersion">The CUDA version. Specify null to automatically use the highest installed version.</param>
        /// <param name="compile">if set to <c>true</c> compile to PTX.</param>
        /// <param name="types">The types.</param>
        /// <returns>A CudafyModule.</returns>
        public static CudafyModule Cudafy(ePlatform platform, eArchitecture arch, Version cudaVersion, bool compile, params Type[] types)
        {
            var cp = CompilerHelper.Create(ePlatform.Auto, arch, eCudafyCompileMode.Default, WorkingDirectory, GenerateDebug);

            if (!compile)
            {
                cp.CompileMode = eCudafyCompileMode.TranslateOnly;
            }
            return(Cudafy(cp, types));
        }
Пример #19
0
 public static string Compile(string file, bool clean)
 {
     return(CompilerHelper.Compile(
                file,
                FirstSetup.OutputDirectory,
                FirstSetup.InternalDirectory,
                clean,
                new[] { "HL-expr", "bin" }
                ));
 }
Пример #20
0
        public void SetUp()
        {
            //var x = CompilerHelper.Create(ePlatform.x64, eArchitecture.OpenCL, eCudafyCompileMode.Default);
            var y = CompilerHelper.Create(ePlatform.x64, CudafyModes.Architecture, eCudafyCompileMode.DynamicParallelism);

            _cm = CudafyTranslator.Cudafy(new CompileProperties[] { y }, this.GetType());
            Console.WriteLine(_cm.CompilerOutput);
            _cm.Serialize();
            _gpu = CudafyHost.GetDevice(y.Architecture, CudafyModes.DeviceId);
            _gpu.LoadModule(_cm);
        }
Пример #21
0
        public AddFunctionResult AddFunction(string name, bool isPublic, ushort typeIndex, bool hasBody, Slice slice, int currentSourceFunctionsStartIndex, out int functionIndex)
        {
            functionIndex = functions.count;
            var result = AddFunctionResult.Success;

            if (name.Length > 0)
            {
                for (var i = 0; i < functions.count; i++)
                {
                    var function = functions.buffer[i];
                    if (function.name != name || !CompilerHelper.IsFunctionVisible(this, i, currentSourceFunctionsStartIndex))
                    {
                        continue;
                    }

                    functionIndex = i;

                    if (!hasBody || function.codeIndex >= 0)
                    {
                        result = AddFunctionResult.AlreadyDefined;
                        break;
                    }

                    if (function.isPublic != isPublic)
                    {
                        result = AddFunctionResult.VisibilityMismatch;
                        break;
                    }

                    if (function.typeIndex != typeIndex)
                    {
                        result = AddFunctionResult.TypeMismatch;
                        break;
                    }

                    functions.buffer[i] = new Function(
                        name,
                        function.isPublic,
                        bytes.count,
                        function.typeIndex
                        );
                    return(AddFunctionResult.Success);
                }
            }

            functions.PushBack(new Function(
                                   name,
                                   isPublic,
                                   hasBody ? bytes.count : -slice.index,
                                   typeIndex
                                   ));

            return(result);
        }
Пример #22
0
        internal string CompileVisualBasicSource()
        {
            List <ITaskItem> sources = new List <ITaskItem>();

            sources.Add(new TaskItem(this.GeneratedCodeFile));

            // If client has added extra user code into the
            // compile request, add it in now
            string userCodeFile = this.UserCodeFile;

            if (!string.IsNullOrEmpty(userCodeFile))
            {
                sources.Add(new TaskItem(userCodeFile));
            }

            // Transform references into a list of ITaskItems.
            // Here, we skip over mscorlib explicitly because this is already included as a project reference.
            List <ITaskItem> references =
                this.ReferenceAssemblies
                .Where(reference => !reference.EndsWith("mscorlib.dll", StringComparison.Ordinal))
                .Select <string, ITaskItem>(reference => new TaskItem(reference) as ITaskItem)
                .ToList();

            Vbc             vbc         = new Vbc();
            MockBuildEngine buildEngine = this.MockBuildEngine;

            vbc.BuildEngine = buildEngine; // needed before task can log

            vbc.NoStandardLib    = true;   // don't include std lib stuff -- we're feeding it silverlight
            vbc.NoConfig         = true;   // don't load the vbc.rsp file to get references
            vbc.TargetType       = "library";
            vbc.Sources          = sources.ToArray();
            vbc.References       = references.ToArray();
            vbc.SdkPath          = CompilerHelper.GetSilverlightSdkReferenceAssembliesPath();
            vbc.RootNamespace    = "TestRootNS";
            vbc.DefineConstants += "SILVERLIGHT";

            vbc.OutputAssembly = new TaskItem(this.OutputAssemblyName);

            bool result = false;

            try
            {
                result = vbc.Execute();
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception occurred invoking VBC task on " + sources[0].ItemSpec + ":\r\n" + ex);
            }

            Assert.IsTrue(result, "VBC failed to compile " + sources[0].ItemSpec + ":\r\n" + buildEngine.ConsoleLogger.Errors);
            return(vbc.OutputAssembly.ItemSpec);
        }
Пример #23
0
        public void InitializationExceptionsAreWrapped()
        {
            Assembly asm = CompilerHelper.CompileFileAndLoadAssembly("Microsoft.Practices.Composite.Tests.Mocks.Modules.MockModuleThrowingException.cs",
                                                                     @".\MocksModulesThwrowing\MockModuleThrowingException.dll");

            ModuleLoader loader = new ModuleLoader(new MockContainerAdapter(), new MockLogger());

            ModuleInfo info = new ModuleInfo(asm.CodeBase.Replace(@"file:///", ""),
                                             "Microsoft.Practices.Composite.Tests.Mocks.Modules.MockModuleThrowingException", "MockModuleThrowingException");

            loader.Initialize(new[] { info });
        }
Пример #24
0
        static void Main(string[] args)
        {
            try
            {
                CudafyModes.DeviceId     = 0;
                CudafyModes.Architecture = CudafyHost.GetDevice(eGPUType.Cuda, CudafyModes.DeviceId).GetArchitecture();  //eArchitecture.sm_35; // *** Change this to the architecture of your target board ***
                CudafyModes.Target       = CompilerHelper.GetGPUType(CudafyModes.Architecture);

                if (CudafyModes.Target != eGPUType.OpenCL)
                {
                    CURANDTests.Basics();
                }

                StringTests st = new StringTests();
                CudafyUnitTest.PerformAllTests(st);

                BasicFunctionTests bft = new BasicFunctionTests();
                CudafyUnitTest.PerformAllTests(bft);

                GMathUnitTests gmu = new GMathUnitTests();
                CudafyUnitTest.PerformAllTests(gmu);

                MultithreadedTests mtt = new MultithreadedTests();
                CudafyUnitTest.PerformAllTests(mtt);

                CopyTests1D ct1d = new CopyTests1D();
                CudafyUnitTest.PerformAllTests(ct1d);

                GPGPUTests gput = new GPGPUTests();
                CudafyUnitTest.PerformAllTests(gput);

                if (CudafyHost.GetDeviceCount(CudafyModes.Target) > 1)
                {
                    MultiGPUTests mgt = new MultiGPUTests();
                    CudafyUnitTest.PerformAllTests(mgt);
                }

                if (CudafyModes.Architecture == eArchitecture.sm_35)
                {
                    Compute35Features c35f = new Compute35Features();
                    CudafyUnitTest.PerformAllTests(c35f);
                }

                Console.WriteLine("Done");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Console.ReadLine();
            }
        }
        private void CompileGeneratedCode(string projectPath, IEnumerable <string> files, string language)
        {
            List <string> referenceAssemblies = MsBuildHelper.GetReferenceAssemblies(projectPath);

            if (language == "C#")
            {
                CompilerHelper.CompileCSharpSourceFromFiles(files, referenceAssemblies, documentationFile: null);
            }
            else
            {
                CompilerHelper.CompileVisualBasicSourceFromFiles(files, referenceAssemblies, "TheRootNamespace", documentationFile: null);
            }
        }
        private void CompileGeneratedCode(string projectPath, IEnumerable <string> files, string language)
        {
            List <string> referenceAssemblies = OpenRiaServices.DomainServices.Tools.Test.MsBuildHelper.GetReferenceAssemblies(projectPath);

            if (language == "C#")
            {
                CompilerHelper.CompileCSharpSource(files, referenceAssemblies);
            }
            else
            {
                CompilerHelper.CompileVisualBasicSource(files, referenceAssemblies, "TheRootNamespace");
            }
        }
        public void GetStartupLoadedModulesDoesntRetrieveOnDemandLoaded()
        {
            string path = @".\AttributedModules";

            CompilerHelper.CleanUpDirectory(path);
            CompilerHelper.CompileFile(@"Microsoft.Practices.Composite.Tests.Mocks.Modules.MockAttributedModule.cs",
                                       @".\AttributedModules\MockAttributedModule.dll");

            IModuleEnumerator enumerator = new DirectoryLookupModuleEnumerator(path);

            Assert.AreEqual <int>(1, enumerator.GetModules().Length);
            Assert.AreEqual <int>(0, enumerator.GetStartupLoadedModules().Length);
        }
        public void ShouldLoadAssemblyEvenIfIsExposingTypesFromAnAssemblyInTheGac()
        {
            CompilerHelper.CompileFile(@"Microsoft.Practices.Prism.Tests.Mocks.Modules.MockExposingTypeFromGacAssemblyModule.cs",
                                       ModulesDirectory4 + @"\MockExposingTypeFromGacAssemblyModule.dll", @"System.Transactions.dll");

            DirectoryModuleCatalog catalog = new DirectoryModuleCatalog();

            catalog.ModulePath = ModulesDirectory4;
            catalog.Load();

            ModuleInfo[] modules = catalog.Modules.ToArray();

            Assert.AreEqual(1, modules.Count());
        }
        public void ShouldNotGetModuleInfoForAnAssemblyAlreadyLoadedInTheMainDomain()
        {
            string path = @".\Mocks\ModulesMainDomain\";

            CompilerHelper.CleanUpDirectory(path);

            var assemblyPath = Assembly.GetCallingAssembly().Location;

            File.Copy(assemblyPath, path + Path.GetFileName(assemblyPath));

            var enumerator = new DirectoryLookupModuleEnumerator(path);

            Assert.AreEqual(0, enumerator.GetModules().Count());
        }
        public void ShouldHonorStartupLoadedAttribute()
        {
            CompilerHelper.CompileFile(@"Microsoft.Practices.Prism.Tests.Mocks.Modules.MockStartupLoadedAttributedModule.cs",
                                       ModulesDirectory3 + @"\MockStartupLoadedAttributedModule.dll");

            DirectoryModuleCatalog catalog = new DirectoryModuleCatalog();

            catalog.ModulePath = ModulesDirectory3;
            catalog.Load();

            ModuleInfo[] modules = catalog.Modules.ToArray();

            Assert.AreEqual(1, modules.Length);
            Assert.AreEqual(InitializationMode.OnDemand, modules[0].InitializationMode);
        }