Exemple #1
0
        public void LinksListXmlTest()
        {
            LinksList links = new LinksList();
            XmlDocument xml = Serializer.SerializeToXml(links);

            Assert.IsNotNull(xml.SelectSingleNode("LINKSLIST"));

        }
        protected void AddDocToLinksList(Document doc, LinksList ll, string UserName)
        {
            HyperLink hl;
              try
              {
            hl = Utils.newTargetBlankHyperlink(Document.GetUrl(doc.DocumentID), DocumentFormatter.GetDocumentContentsString(doc));
              }
              catch(Exception e)
              {
            ErrorLogger.LogException(e);

            string url = "#";
            hl = Utils.newTargetBlankHyperlink(url, DocumentFormatter.GetDocumentContentsString(doc));
              }

              ll.Controls.Add(hl);
        }
        public override CommandExecutionResult Execute()
        {
            CommandExecutionResult result = new CommandExecutionResult(this);
            try
            {
                if (!SvnHelper.IsLocalFolderUnderSvnControl(nantProject.BuildFile.Directory.FullName))
                {
                    MessageBox.Show(mainForm, Resources.LocalFolderNotUnderSourceControl, Resources.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return result;
                }

                if (MessageBox.Show(mainForm, Resources.LinkAnalysisConfirm, Resources.ConfirmationCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {

                    SvnExplorer svnExplorer = new SvnExplorer();
                    svnExplorer.ReadOnly = true;
                    if (svnExplorer.ShowDialog(mainForm) == DialogResult.OK)
                    {
                        LinkAnalysisProgress progress = new LinkAnalysisProgress();
                        progress.SvnExplorerSelection = svnExplorer.GetSvnExplorerSelection();
                        progress.SearchProjectUri = SvnHelper.GetUriFromWorkingCopy(nantProject.BuildFile.Directory.FullName);
                        progress.ShowDialog(mainForm);
                        LinksList linksList = new LinksList();
                        linksList.Prefix = Resources.DependentProjects;
                        linksList.Project = SvnHelper.GetUriFromWorkingCopy(nantProject.BuildFile.Directory.FullName);
                        foreach (string link in progress.Result)
                        {
                            linksList.AddLink(link, string.Empty);
                        }
                        linksList.ShowDialog(mainForm);
                    }
                }
            }
            catch (Exception ex)
            {
                result.Error = ex;
            }

            return result;
        }
        public override CommandExecutionResult Execute()
        {
            CommandExecutionResult result = new CommandExecutionResult(this);
            try
            {
                if (!SvnHelper.IsLocalFolderUnderSvnControl(nantProject.BuildFile.Directory.FullName))
                {
                    MessageBox.Show(mainForm, Resources.LocalFolderNotUnderSourceControl, Resources.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return result;
                }

                string externalProp = SvnHelper.GetProperty(nantProject.BuildFile.Directory.FullName, SvnHelper.EXTERNALS_PROPERTY_NAME) ?? string.Empty;
                LinksList linksList = new LinksList();
                linksList.Prefix = Resources.ProjectDependencies;
                linksList.Project = SvnHelper.GetUriFromWorkingCopy(nantProject.BuildFile.Directory.FullName);
                List<string> links = new List<string>();
                using(StringReader reader = new StringReader(externalProp))
                {
                    string external = reader.ReadLine();
                    while(external != null)
                    {
                        string[] splittedExternal = external.Split(' ');
                        if (splittedExternal.Length == 2)
                        {
                            linksList.AddLink(splittedExternal[0].Replace(" ", "%20"), splittedExternal[1]);
                        }
                        external = reader.ReadLine();
                    }
                }
                linksList.ShowDialog(mainForm);
            }
            catch (Exception ex)
            {
                result.Error = ex;
            }
            return result;
        }
Exemple #5
0
 /// <summary>
 /// Returns a test LinksList
 /// </summary>
 /// <returns></returns>
 public static LinksList CreateTestLinksList()
 {
     var links = new LinksList()
     {
         Links = new List<Link>
         {                   
             LinkTest.CreateLink()
         }
     };
     return links;
 }
Exemple #6
0
 public void GetCacheKeyTest()
 {
     var links = new LinksList();
     string expected = string.Format("{0}|0|0|0|0|True|0|", typeof(LinksList).AssemblyQualifiedName);
     string actual = links.GetCacheKey(0, 0, 0, 0, true, 0);
     Assert.AreEqual(expected, actual);
 }
Exemple #7
0
        public void IsUpToDate_LinksListOutOfDate_ReturnsCorrect()
        {
            // PREPARE THE TEST
            // setup the default mocks
            MockRepository mocks = new MockRepository();

            var target = new LinksList()
            {                
                Links = new List<Link> { LinkTest.CreateLink()}
            };

            var reader = mocks.DynamicMock<IDnaDataReader>();
            reader.Stub(x => x.HasRows).Return(true);
            reader.Stub(x => x.Read()).Return(false);

            var creator = mocks.DynamicMock<IDnaDataReaderCreator>();
            mocks.ReplayAll();

            Assert.AreEqual(false, target.IsUpToDate(creator));
        }