示例#1
0
        WebReferencesProjectItem AddWebReferencesToProject(string include)
        {
            var item = new WebReferencesProjectItem(project);

            item.Include = @"Web References\";
            ProjectService.AddProjectItem(project, item);
            return(item);
        }
示例#2
0
        List <ProjectItem> CreateProjectItems()
        {
            List <ProjectItem> items = new List <ProjectItem>();

            // Web references item.
            if (!ProjectContainsWebReferencesFolder(project))
            {
                WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project);
                webReferencesItem.Include = "Web References\\";
                items.Add(webReferencesItem);
            }

            // Web reference url.
            webReferenceUrl               = new WebReferenceUrl(project);
            webReferenceUrl.Include       = url;
            webReferenceUrl.UpdateFromURL = url;
            webReferenceUrl.RelPath       = relativePath;
            webReferenceUrl.Namespace     = proxyNamespace;
            items.Add(webReferenceUrl);

            // References.
            foreach (DictionaryEntry entry in protocol.References)
            {
                DiscoveryReference discoveryRef = entry.Value as DiscoveryReference;
                if (discoveryRef != null)
                {
                    FileProjectItem item = new FileProjectItem(project, ItemType.None);
                    item.Include = Path.Combine(relativePath, discoveryRef.DefaultFilename);
                    items.Add(item);
                }
            }

            // Proxy
            FileProjectItem proxyItem = new FileProjectItem(project, ItemType.Compile);

            proxyItem.Include = GetProxyFileName();
            proxyItem.SetEvaluatedMetadata("AutoGen", "True");
            proxyItem.SetEvaluatedMetadata("DesignTime", "True");
            proxyItem.DependentUpon = "Reference.map";
            items.Add(proxyItem);

            // Reference map.
            FileProjectItem mapItem = new FileProjectItem(project, ItemType.None);

            mapItem.Include = Path.Combine(relativePath, "Reference.map");
            mapItem.SetEvaluatedMetadata("Generator", "MSDiscoCodeGenerator");
            mapItem.SetEvaluatedMetadata("LastGenOutput", "Reference.cs");
            items.Add(mapItem);

            // System.Web.Services reference.
            if (!ProjectContainsWebServicesReference(project))
            {
                ReferenceProjectItem webServicesReferenceItem = new ReferenceProjectItem(project, "System.Web.Services");
                items.Add(webServicesReferenceItem);
            }
            return(items);
        }
示例#3
0
        public void IsWebReferencesFolder_FolderDoesNotMatchWebReferencesProjectItemFolder_ReturnsFalse()
        {
            CreateProject();
            project.FileName = FileName.Create(@"C:\projects\test\foo.csproj");
            AddWebReferencesToProject(@"Web References\");

            bool result = WebReferencesProjectItem.IsWebReferencesFolder(project, @"C:\projects\test\foo");

            Assert.IsFalse(result);
        }
示例#4
0
        public void IsWebReferencesFolder_FolderMatchesWebReferencesProjectItemFolder_ReturnsTrue()
        {
            CreateProject();
            project.FileName = @"C:\projects\test\foo.csproj";
            AddWebReferencesToProject(@"Web References\");

            bool result = WebReferencesProjectItem.IsWebReferencesFolder(project, @"C:\projects\test\Web References");

            Assert.IsTrue(result);
        }
        public void IsNotWebReferencesFolder1()
        {
            MSBuildBasedProject p = WebReferenceTestHelper.CreateTestProject("C#");

            p.FileName = "C:\\projects\\test\\foo.csproj";
            WebReferencesProjectItem item = new WebReferencesProjectItem(p);

            item.Include = "Web References\\";
            ProjectService.AddProjectItem(p, item);

            Assert.IsFalse(DirectoryNode.IsWebReferencesFolder(p, "C:\\projects\\test\\foo"));
        }
示例#6
0
        public override void FixtureSetUp()
        {
            base.FixtureSetUp();
            MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");

            project.FileName = FileName.Create("c:\\projects\\test\\foo.csproj");

            // Web references item.
            WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project);

            webReferencesItem.Include = "Web References\\";
            ProjectService.AddProjectItem(project, webReferencesItem);

            // Web reference url.
            WebReferenceUrl webReferenceUrl = new WebReferenceUrl(project);

            webReferenceUrl.Include       = "http://localhost/test.asmx";
            webReferenceUrl.UpdateFromURL = "http://localhost/test.asmx";
            webReferenceUrl.RelPath       = "Web References\\localhost";
            ProjectService.AddProjectItem(project, webReferenceUrl);

            FileProjectItem discoFileItem = new FileProjectItem(project, ItemType.None);

            discoFileItem.Include = "Web References\\localhost\\test.disco";
            ProjectService.AddProjectItem(project, discoFileItem);

            FileProjectItem wsdlFileItem = new FileProjectItem(project, ItemType.None);

            wsdlFileItem.Include = "Web References\\localhost\\test.wsdl";
            ProjectService.AddProjectItem(project, wsdlFileItem);

            // Proxy
            FileProjectItem proxyItem = new FileProjectItem(project, ItemType.Compile);

            proxyItem.Include       = "Web References\\localhost\\Reference.cs";
            proxyItem.DependentUpon = "Reference.map";
            ProjectService.AddProjectItem(project, proxyItem);

            // Reference map.
            FileProjectItem mapItem = new FileProjectItem(project, ItemType.None);

            mapItem.Include = "Web References\\localhost\\Reference.map";
            ProjectService.AddProjectItem(project, mapItem);

            // System.Web.Services reference.
            ReferenceProjectItem webServicesReferenceItem = new ReferenceProjectItem(project, "System.Web.Services");

            ProjectService.AddProjectItem(project, webServicesReferenceItem);

            projectItems = WebReference.GetFileItems(project, "localhost");
        }
        public void SetupFixture()
        {
            project          = WebReferenceTestHelper.CreateTestProject("C#");
            project.FileName = "C:\\Projects\\Web.csproj";
            WebReferencesProjectItem item = new WebReferencesProjectItem(project);

            item.Include = "Foo\\";
            ProjectService.AddProjectItem(project, item);

            protocol = new DiscoveryClientProtocol();

            WebReferenceTestHelper.InitializeProjectBindings();

            webReference    = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
            webReferenceUrl = (WebReferenceUrl)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.WebReferenceUrl);
        }
        public override void FixtureSetUp()
        {
            base.FixtureSetUp();
            project          = WebReferenceTestHelper.CreateTestProject("C#");
            project.FileName = FileName.Create("C:\\Projects\\Web.csproj");
            WebReferencesProjectItem item = new WebReferencesProjectItem(project);

            item.Include = "Web References\\";
            ProjectService.AddProjectItem(project, item);

            protocol = new DiscoveryClientProtocol();
            DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();

            discoveryRef.Url = updateFromUrl;
            protocol.References.Add(discoveryRef);

            ContractReference contractRef = new ContractReference();

            contractRef.Url            = "http://localhost/test.asmx?wsdl";
            contractRef.ClientProtocol = new DiscoveryClientProtocol();
            ServiceDescription desc = new ServiceDescription();

            contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
            protocol.References.Add(contractRef);

            WebReferenceTestHelper.InitializeProjectBindings();

            webReference = new Gui.WebReference(project, updateFromUrl, oldName, proxyNamespace, protocol);

            // Force generation of items.
            List <ProjectItem> items = webReference.Items;

            // Change the web reference name.
            webReference.Name = name;
            webReferenceUrl   = (WebReferenceUrl)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.WebReferenceUrl);

            discoFileProjectItem        = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\test.disco", ItemType.None);
            referenceMapFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\Reference.map", ItemType.None);
            wsdlFileProjectItem         = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\test.wsdl", ItemType.None);
            proxyFileProjectItem        = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\Reference.cs", ItemType.Compile);
        }
        public void SetUpFixture()
        {
            // Set up the project.
            MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");

            project.FileName = "c:\\projects\\test\\foo.csproj";

            // Web references item.
            WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project);

            webReferencesItem.Include = "Web References\\";
            ProjectService.AddProjectItem(project, webReferencesItem);

            // Web reference url.
            WebReferenceUrl webReferenceUrl = new WebReferenceUrl(project);

            webReferenceUrl.Include       = "http://localhost/test.asmx";
            webReferenceUrl.UpdateFromURL = "http://localhost/test.asmx";
            webReferenceUrl.RelPath       = "Web References\\localhost";
            ProjectService.AddProjectItem(project, webReferenceUrl);

            FileProjectItem discoFileItem = new FileProjectItem(project, ItemType.None);

            discoFileItem.Include = "Web References\\localhost\\test.disco";
            ProjectService.AddProjectItem(project, discoFileItem);

            FileProjectItem wsdlFileItem = new FileProjectItem(project, ItemType.None);

            wsdlFileItem.Include = "Web References\\localhost\\test.wsdl";
            ProjectService.AddProjectItem(project, wsdlFileItem);

            // Proxy
            FileProjectItem proxyItem = new FileProjectItem(project, ItemType.Compile);

            proxyItem.Include       = "Web References\\localhost\\Reference.cs";
            proxyItem.DependentUpon = "Reference.map";
            ProjectService.AddProjectItem(project, proxyItem);

            // Reference map.
            FileProjectItem mapItem = new FileProjectItem(project, ItemType.None);

            mapItem.Include = "Web References\\localhost\\Reference.map";
            ProjectService.AddProjectItem(project, mapItem);

            // System.Web.Services reference.
            ReferenceProjectItem webServicesReferenceItem = new ReferenceProjectItem(project, "System.Web.Services");

            ProjectService.AddProjectItem(project, webServicesReferenceItem);

            // Set up the web reference.
            DiscoveryClientProtocol    protocol     = new DiscoveryClientProtocol();
            DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();

            discoveryRef.Url = "http://localhost/new.asmx";
            protocol.References.Add(discoveryRef);

            ContractReference contractRef = new ContractReference();

            contractRef.Url            = "http://localhost/new.asmx?wsdl";
            contractRef.ClientProtocol = new DiscoveryClientProtocol();
            ServiceDescription desc = new ServiceDescription();

            contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
            protocol.References.Add(contractRef);

            WebReferenceTestHelper.InitializeProjectBindings();

            SD.WebReference webReference = new SD.WebReference(project, "http://localhost/new.asmx", "localhost", "ProxyNamespace", protocol);
            changes = webReference.GetChanges(project);
        }