Example #1
0
        public void Update_ShouldNotModifyProject(bool filterConditionalReferences)
        {
            // Give it a file that would NOT be updated
            string targetSolution = Path.Combine(TestContext.CurrentContext.TestDirectory, "TestProjects", "SimpleDependency", "AllProjects.sln");
            bool   actual         = SolutionUpdater.Update(targetSolution, filterConditionalReferences, false);

            Assert.That(actual, Is.EqualTo(false), "The solution should NOT have been updated");
        }
Example #2
0
        public void Update_ModifiesProject(bool filterConditionalReferences)
        {
            // Give it a file that would be updated
            string targetSolution = Path.Combine(TestContext.CurrentContext.TestDirectory, "TestProjects", "SimpleDependency", "FromPerspective_A_Unpopulated.sln");
            bool   actual         = SolutionUpdater.Update(targetSolution, filterConditionalReferences, false);

            Assert.That(actual, Is.EqualTo(true), "The solution should have been updated");
        }
Example #3
0
 internal static void Stop()
 {
     SolutionUpdater.Stop();
     LoginWindow.Window.Dispatcher.Invoke(new Action(() =>
     {
         Log.CloseWindow();
         LoginWindow.Window.Close();
     }));
 }
Example #4
0
        public void _InsertNewProjectsInternal_ValidArguments(string targetSolution, IEnumerable <string> newReferences, string expectedSolution)
        {
            // First load up the expected solution into a file
            string[] expected = File.ReadAllLines(expectedSolution);

            // Arrange the call
            SolutionFile solution = SolutionFile.Parse(targetSolution);

            string[] actual = SolutionUpdater._InsertNewProjectsInternal(targetSolution, solution, newReferences);

            // Assert; note we have to use EquivalentTo here because the ordering is not defined
            Assert.That(actual, Is.EquivalentTo(expected));
        }
Example #5
0
        private static void InitWithSelectedSolution()
        {
            string fullSolutionName = SelectedSolution.BuildFullSolutionName();

            if (releaseMode)
            {
                SolutionDirPath = string.Format(@"{0}\Aramis .NET\{1}\", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), fullSolutionName);
            }
            else
            {
                SolutionDirPath = @"..\..\..\..\GreenHouse\GreenHouse\bin\Release\";
            }

            RegistryHelper.Init(fullSolutionName);

            SolutionUpdater.Init();
        }
Example #6
0
        private void InitSolutionDomain()
        {
            solutionDomain = AppDomain.CreateDomain("Solution domain", null, new AppDomainSetup
            {
                ApplicationBase   = App.SolutionDirPath.Substring(0, App.SolutionDirPath.Length - 1),
                ConfigurationFile = solutionExecutiveFileName + ".config"
            });

            solutionDomain.SetData(LOADED_STR, false);

            solutionDomain.SetData(SERVER_NAME_STR, App.SelectedSolution.SqlServerName);
            solutionDomain.SetData(VERSION_NUMBER, SolutionUpdater.ReadUpdateNumber());
            solutionDomain.SetData(DATABASE_NAME_STR, App.SelectedSolution.SqlBaseName);

            solutionDomain.SetData(STARTER_PATH_VAR_NAME, SolutionUpdater.STARTER_PATH);

            solutionDomain.SetData(USER_ID_STR, LoginWindow.UserName);
            solutionDomain.SetData(USER_KEY_STR, Encryptor.ConvertToByte(LoginWindow.UserPassword));

            solutionDomain.SetData(EXECUTE_ERROR, "");
        }
Example #7
0
        private void ExecuteSolution()
        {
            if (!RegistrateSolutionExecuting())
            {
                return;
            }

            InitSolutionDomain();
            DateTime startTime = DateTime.Now;

            try
            {
                solutionDomain.ExecuteAssembly(solutionExecutiveFileName);
                Log.Append("Executed - OK");
            }
            catch (ThreadAbortException abortExp)
            {
                Log.Append("Executing ThreadAbortException - " + abortExp.Message);
                App.Stop();
                return;
            }

            catch (Exception exp)
            {
                Log.Append("Executing exception - " + exp.Message);
                executionError = string.Format("ExecuteAssembly error: {0}", exp.Message);
                Trace.WriteLine(executionError);

                string fileName = Path.GetDirectoryName(SolutionUpdater.STARTER_PATH) + "\\" + "lastError.txt";
                try
                {
                    File.WriteAllText(fileName, exp.Message + "\r\n" + exp.StackTrace);
                }
                catch { }

                if (ExecutingTimeUnreallySmall(startTime))
                {
                    SolutionUpdater.ResetVersion();
                    // tell to updater to updateVersion
                    return;
                }
            }

            while (solutionDomain.GetData(EXIT_STATUS_VAR_NAME) == null)
            {
                Thread.Sleep(WAIT_FOR_THREADS_COMPLATING_INTERVAL_MILLISEC);
            }

            //GC.WaitForPendingFinalizers();
            //GC.Collect();
            //GC.WaitForPendingFinalizers();
            //object exitForUpdateObj = solutionDomain.GetData(UPDATE_MODE_VAR_NAME);
            //object forsedUpdateObj = solutionDomain.GetData(FORSED_UPDATE_VAR_NAME);

            //try
            //    {
            //    Log.Append("before domain unload");
            //    AppDomain.Unload(solutionDomain);
            //    Log.Append("domain unloaded");
            //    }
            //catch
            //    {
            //    Log.Append("error domain unloaded");
            //    return false;
            //    }

            //solutionDomain = null;
            //GC.Collect();
            //GC.WaitForPendingFinalizers();

            //RegistrateSolutionExit();
            //Log.Append("RegistrateSolutionExit() solutionExecuting = " + solutionExecuting.ToString());

            //exitForUpdate = (exitForUpdateObj != null) && (exitForUpdateObj is bool) && (bool)exitForUpdateObj;
            //forsedUpdate = (forsedUpdateObj != null) && (forsedUpdateObj is bool) && (bool)forsedUpdateObj;
            //Log.Append("exit ExecuteSolution");
            //return true;
        }
Example #8
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     SolutionUpdater.ResetVersion();
 }
Example #9
0
 void DoUpdate()
 {
     SolutionUpdater.Update(_solution, _update);
 }
Example #10
0
        public void GetNewDependenciesInSolution_ValidArguments(SolutionFile solution, bool filterConditionalReferences, string[] expected)
        {
            string[] actual = SolutionUpdater.GetNewDependenciesInSolution(solution, filterConditionalReferences);

            Assert.That(actual, Is.EqualTo(expected));
        }