public void TestCheckRepositoriesForUpdates()
        {
            // Reads the configuration file to initialise the model correctly.
            _deploymentService.ReadConfigurationFromFile();

            Assert.AreEqual(_deploymentService.RepositoriesNeedingUpdate.Count(), 0, "There are repositories needing update before checking for updates, which should never happen.");
            bool result = _deploymentService.CheckRepositoriesForUpdates();

            Assert.IsTrue(result, "Function that checks repositories for updates returned false when true was expected.");
            Assert.Greater(_deploymentService.RepositoriesNeedingUpdate.Count(), 0, "No repositories have been reported as needing updates after checking for updates, when there should've been at least one.");

            // TODO: Test if no local branch is present but a remote branch is, that the repository is added as needing update.
            // TODO: Test if the local branch is behind remote branch that the repository is added as needing update.
        }
Example #2
0
        /// <summary>
        /// Checks the repositories for updates.
        /// </summary>
        /// <returns>
        ///   <c>true</c> if any repositories have been updated; <c>false</c> otherwise.
        /// </returns>
        /// <seealso cref="RepositoriesNeedingUpdate" />
        /// <remarks>
        /// The list of repositories for which there are updates is made available through <see cref="RepositoriesNeedingUpdate" />.
        /// </remarks>
        public bool CheckRepositoriesForUpdates()
        {
            bool result = false;

            if (_repositoryService != null)
            {
                result = _repositoryService.CheckRepositoriesForUpdates();
            }
            else
            {
                // TODO: Log that repository service is not present.
            }

            return(result);
        }