Exemplo n.º 1
0
        int IVsHierarchy.ParseCanonicalName(string name, out uint itemId)
        {
            FakeProjectItem item = this.ParseCanonicalName(name);

            itemId = item.Id;
            return(VSConstants.S_OK);
        }
 public BrowseObjectExtenderTest()
 {
     this.dte = new FakeDte();
     this.solution = new FakeSolution(this.dte);
     this.project = new FakeProject(this.solution);
     this.projectItem = new FakeProjectItem(this.project);
     this.extenderSite = new StubExtenderSite();
 }
Exemplo n.º 3
0
 public CustomToolParameterTest()
 {
     this.dte = new FakeDte();
     this.solution = new FakeSolution(this.dte);
     this.project = new FakeProject(this.solution);
     this.projectItem = new FakeProjectItem(this.project);
     this.parent = new CustomToolParameters(this.dte, this.project, this.projectItem.Id);
 }
Exemplo n.º 4
0
        public FakeProjectItem(FakeProjectItem parent) : this()
        {
            Debug.Assert(parent != null, "parent");

            this.ContainingProject = parent.ContainingProject;
            this.Dte = parent.Dte;
            this.Id  = this.ContainingProject.ProjectItems.Select(item => item.Id).DefaultIfEmpty().Max() + 1;
            parent.ProjectItems.Add(this);
        }
Exemplo n.º 5
0
        public FakeProjectItem(FakeProjectItem parent) : this()
        {
            Debug.Assert(parent != null, "parent");

            this.ContainingProject = parent.ContainingProject;
            this.Dte = parent.Dte;
            this.Id = this.ContainingProject.ProjectItems.Select(item => item.Id).DefaultIfEmpty().Max() + 1;
            parent.ProjectItems.Add(this);
        }
 public CustomToolParametersTest()
 {
     this.dte = new FakeDte();
     this.dte.AddService(typeof(TemplateLocator), new FakeTemplateLocator(), false);
     this.dte.AddService(typeof(STextTemplating), new FakeTextTemplatingService(), false);
     this.solution = new FakeSolution(this.dte);
     this.project = new FakeProject(this.solution);
     this.projectItem = new FakeProjectItem(this.project);
 }
Exemplo n.º 7
0
        public void SetItemAttribute(uint itemId, string attributeName, string attributeValue)
        {
            FakeProjectItem item = this.ProjectItems.First(pi => pi.Id == itemId);

            if (string.IsNullOrEmpty(attributeValue))
            {
                item.Metadata.Remove(attributeName);
            }
            else
            {
                item.Metadata[attributeName] = attributeValue;
            }
        }
Exemplo n.º 8
0
        public FakeProjectItem FindProjectItem(string fileName)
        {
            foreach (FakeProject project in this.Projects)
            {
                FakeProjectItem projectItem = project.ProjectItems.FirstOrDefault(pi => pi.TestFile.FullName == fileName);
                if (projectItem != null)
                {
                    return(projectItem);
                }
            }

            return(null);
        }
Exemplo n.º 9
0
        public OutputFileManagerTest()
        {
            this.dte = new FakeDte();
            this.solution = new FakeSolution(this.dte);
            this.project = new FakeProject(this.solution);
            this.projectItem = new FakeProjectItem(this.project);
            this.textTemplating = new FakeTextTemplating();
            this.queryEditQuerySave = new StubIVsQueryEditQuerySave();
            this.runningDocumentTable = new StubIVsRunningDocumentTable();

            this.dte.AddService(typeof(STextTemplating), this.textTemplating, false);
            this.dte.AddService(typeof(SVsQueryEditQuerySave), this.queryEditQuerySave, false);
            this.dte.AddService(typeof(SVsRunningDocumentTable), this.runningDocumentTable, false);
        }
Exemplo n.º 10
0
        public void ProjectItemFinishedGeneratingSetsMetadata()
        {
            using (var dte = new FakeDte())
            {
                var solution = new FakeSolution(dte);
                var project = new FakeProject(solution);
                var projectItem = new FakeProjectItem(project);

                var replacements = new Dictionary<string, string>();
                replacements["$wizarddata$"] = @"
                    <Properties>
                        <Generator>TextTemplatingFilePreprocessor</Generator>
                    </Properties>";

                var wizard = new ItemMetadataWizard();
                wizard.RunStarted(null, replacements, default(WizardRunKind), null);
                wizard.ProjectItemFinishedGenerating(projectItem);

                // Wizard should clear the value
                Assert.AreEqual("TextTemplatingFilePreprocessor", projectItem.GetItemAttribute("Generator"));
            }
        }