Exemple #1
0
        private InitializeSolutionTestInfo InitializeTest(Action <InitializeSolutionInfo> setCustomSettings = null, string tempDirectoryName = null)
        {
            var tempDir = tempDirectoryName == null
                ? TempDir.Create()
                : new TempDir(tempDirectoryName);

            TestBase.ClearDirectory(tempDir.Name);
            var solutionPath             = Path.Combine(tempDir.Name, @"Abc.Xrm\Abc.Xrm.sln");
            var solutionDirectory        = Path.GetDirectoryName(solutionPath) ?? "";
            var ebgPath                  = Path.Combine(solutionDirectory + @"DLaB.EBG.Settings.xml");
            var testSolutionTemplatePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            Directory.CreateDirectory(solutionDirectory);
            // Copy Solution and EarlyBoundSettings Xml to Temp Folder
            File.Copy(Path.Combine(testSolutionTemplatePath ?? "", @"SolutionTemplate\Abc.Xrm.sln"), solutionPath, true);
            File.Copy(Path.Combine(testSolutionTemplatePath ?? "", @"SolutionTemplate\DLaB.EBG.Settings.xml"), ebgPath, true);

            var results = new object[]
            {
                new List <string> {
                    "Y", solutionPath
                },
                "Abc.Xrm",
                new NuGetPackage
                {
                    Id               = "Microsoft.CrmSdk.CoreAssemblies",
                    LicenseUrl       = "http://download.microsoft.com/download/E/1/8/E18C0FAD-FEC8-44CD-9A16-98EDC4DAC7A2/LicenseTerms.docx",
                    Name             = "Microsoft Dynamics 365 SDK core assemblies",
                    Version          = new Version("9.0.2.5"),
                    VersionText      = "9.0.2.5",
                    XrmToolingClient = false
                },
                "Y",
                "Abc.Xrm",
                "Abc.Xrm.WorkflowCore",
                new List <string> {
                    "Y", "Abc.Xrm.Test", "Abc.Xrm.TestCore"
                },
                new List <string> {
                    "Y", "Abc.Xrm.Plugin", "0"
                },
                "Abc.Xrm.Plugin.Tests",
                new List <string> {
                    "Y", "Abc.Xrm.Workflow", "0"
                },
                "Abc.Xrm.Workflow.Tests",
                new List <string> {
                    "0", "0"
                },
            };
            var info = InitializeSolutionInfo.InitializeSolution(results);

            setCustomSettings?.Invoke(info);

            var templatePath = TestBase.GetTemplatePath();
            var context      = new InitializeSolutionTestInfo
            {
                Info              = info,
                TempDir           = tempDir,
                TemplatePath      = templatePath,
                SolutionDirectory = solutionDirectory
            };

            var logic = new SolutionInitializer(context.Info.SolutionPath, context.TemplatePath);

            logic.Projects = logic.GetProjectInfos(context.Info);
            context.SolutionInitializer = logic;
            return(context);
        }
Exemple #2
0
 public void Dispose()
 {
     TempDir?.Dispose();
 }