Initial commit from CodePlex 2017-09-02
0 parents
Showing
33 changed files
with
4236 additions
and
0 deletions
WebServicePluginForWebTest.sln
0 → 100644
| 1 | | ||
| 2 | Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| 3 | # Visual Studio 2012 | ||
| 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServicePluginForWebTestMessageEditor", "WebTestWebServiceMessageEditor\WebServicePluginForWebTestMessageEditor.csproj", "{23707A49-589B-4A36-BDAA-2896E647D07D}" | ||
| 5 | EndProject | ||
| 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServicePluginForWebTestResultTab", "WebTestWebServiceResultAddin\WebServicePluginForWebTestResultTab.csproj", "{48B3509E-1FD8-4875-8FC6-137647EB83AA}" | ||
| 7 | EndProject | ||
| 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServicePluginForWebTestRuntime", "WebTestWebServiceRuntime\WebServicePluginForWebTestRuntime.csproj", "{F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}" | ||
| 9 | EndProject | ||
| 10 | Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "WebServicePluginsSetup", "WebTestWebServiceSetup\WebServicePluginsSetup.wixproj", "{73ACCDA5-47C1-40C9-B63E-AFF657E046E4}" | ||
| 11 | EndProject | ||
| 12 | Global | ||
| 13 | GlobalSection(TeamFoundationVersionControl) = preSolution | ||
| 14 | SccNumberOfProjects = 4 | ||
| 15 | SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} | ||
| 16 | SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs03 | ||
| 17 | SccProjectUniqueName0 = WebTestWebServiceRuntime\\WebServicePluginForWebTestRuntime.csproj | ||
| 18 | SccProjectName0 = WebTestWebServiceRuntime | ||
| 19 | SccAuxPath0 = https://tfs.codeplex.com/tfs/tfs03 | ||
| 20 | SccLocalPath0 = WebTestWebServiceRuntime | ||
| 21 | SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} | ||
| 22 | SccProjectUniqueName1 = WebTestWebServiceResultAddin\\WebServicePluginForWebTestResultTab.csproj | ||
| 23 | SccProjectName1 = WebTestWebServiceResultAddin | ||
| 24 | SccAuxPath1 = https://tfs.codeplex.com/tfs/tfs03 | ||
| 25 | SccLocalPath1 = WebTestWebServiceResultAddin | ||
| 26 | SccProvider1 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} | ||
| 27 | SccProjectUniqueName2 = WebTestWebServiceMessageEditor\\WebServicePluginForWebTestMessageEditor.csproj | ||
| 28 | SccProjectName2 = WebTestWebServiceMessageEditor | ||
| 29 | SccAuxPath2 = https://tfs.codeplex.com/tfs/tfs03 | ||
| 30 | SccLocalPath2 = WebTestWebServiceMessageEditor | ||
| 31 | SccProvider2 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} | ||
| 32 | SccProjectUniqueName3 = WebTestWebServiceSetup\\WebServicePluginsSetup.wixproj | ||
| 33 | SccProjectName3 = WebTestWebServiceSetup | ||
| 34 | SccAuxPath3 = https://tfs.codeplex.com/tfs/tfs03 | ||
| 35 | SccLocalPath3 = WebTestWebServiceSetup | ||
| 36 | SccProvider3 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} | ||
| 37 | EndGlobalSection | ||
| 38 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| 39 | Debug|Any CPU = Debug|Any CPU | ||
| 40 | Debug|Mixed Platforms = Debug|Mixed Platforms | ||
| 41 | Debug|x86 = Debug|x86 | ||
| 42 | Release|Any CPU = Release|Any CPU | ||
| 43 | Release|Mixed Platforms = Release|Mixed Platforms | ||
| 44 | Release|x86 = Release|x86 | ||
| 45 | EndGlobalSection | ||
| 46 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| 47 | {23707A49-589B-4A36-BDAA-2896E647D07D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 48 | {23707A49-589B-4A36-BDAA-2896E647D07D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 49 | {23707A49-589B-4A36-BDAA-2896E647D07D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | ||
| 50 | {23707A49-589B-4A36-BDAA-2896E647D07D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU | ||
| 51 | {23707A49-589B-4A36-BDAA-2896E647D07D}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
| 52 | {23707A49-589B-4A36-BDAA-2896E647D07D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 53 | {23707A49-589B-4A36-BDAA-2896E647D07D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 54 | {23707A49-589B-4A36-BDAA-2896E647D07D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | ||
| 55 | {23707A49-589B-4A36-BDAA-2896E647D07D}.Release|Mixed Platforms.Build.0 = Release|Any CPU | ||
| 56 | {23707A49-589B-4A36-BDAA-2896E647D07D}.Release|x86.ActiveCfg = Release|Any CPU | ||
| 57 | {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 58 | {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 59 | {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | ||
| 60 | {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU | ||
| 61 | {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
| 62 | {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 63 | {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 64 | {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | ||
| 65 | {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Release|Mixed Platforms.Build.0 = Release|Any CPU | ||
| 66 | {48B3509E-1FD8-4875-8FC6-137647EB83AA}.Release|x86.ActiveCfg = Release|Any CPU | ||
| 67 | {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| 68 | {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| 69 | {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU | ||
| 70 | {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU | ||
| 71 | {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
| 72 | {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| 73 | {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| 74 | {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU | ||
| 75 | {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Release|Mixed Platforms.Build.0 = Release|Any CPU | ||
| 76 | {F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}.Release|x86.ActiveCfg = Release|Any CPU | ||
| 77 | {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Debug|Any CPU.ActiveCfg = Debug|x86 | ||
| 78 | {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 | ||
| 79 | {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Debug|Mixed Platforms.Build.0 = Debug|x86 | ||
| 80 | {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Debug|x86.ActiveCfg = Debug|x86 | ||
| 81 | {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Debug|x86.Build.0 = Debug|x86 | ||
| 82 | {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Release|Any CPU.ActiveCfg = Release|x86 | ||
| 83 | {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Release|Mixed Platforms.ActiveCfg = Release|x86 | ||
| 84 | {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Release|Mixed Platforms.Build.0 = Release|x86 | ||
| 85 | {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Release|x86.ActiveCfg = Release|x86 | ||
| 86 | {73ACCDA5-47C1-40C9-B63E-AFF657E046E4}.Release|x86.Build.0 = Release|x86 | ||
| 87 | EndGlobalSection | ||
| 88 | GlobalSection(SolutionProperties) = preSolution | ||
| 89 | HideSolutionNode = FALSE | ||
| 90 | EndGlobalSection | ||
| 91 | EndGlobal |
| 1 | //************************************************************************************************* | ||
| 2 | // MessageEditor.Designer.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // UI of Editor for Web Service Request Body | ||
| 6 | // The Web Service response can be plain XML or 'application/soap+msbin1' | ||
| 7 | // (binary - used by Silverlight application with WCF RIA) or JSON | ||
| 8 | // | ||
| 9 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 10 | //************************************************************************************************* | ||
| 11 | namespace WebTest.WebService.Plugin.MessageEditors | ||
| 12 | { | ||
| 13 | partial class MessageEditor | ||
| 14 | { | ||
| 15 | /// <summary> | ||
| 16 | /// Required designer variable. | ||
| 17 | /// </summary> | ||
| 18 | private System.ComponentModel.IContainer components = null; | ||
| 19 | |||
| 20 | /// <summary> | ||
| 21 | /// Clean up any resources being used. | ||
| 22 | /// </summary> | ||
| 23 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | ||
| 24 | protected override void Dispose(bool disposing) | ||
| 25 | { | ||
| 26 | if (disposing && (components != null)) | ||
| 27 | { | ||
| 28 | components.Dispose(); | ||
| 29 | } | ||
| 30 | base.Dispose(disposing); | ||
| 31 | } | ||
| 32 | |||
| 33 | #region Component Designer generated code | ||
| 34 | |||
| 35 | /// <summary> | ||
| 36 | /// Required method for Designer support - do not modify | ||
| 37 | /// the contents of this method with the code editor. | ||
| 38 | /// </summary> | ||
| 39 | private void InitializeComponent() | ||
| 40 | { | ||
| 41 | this.requestTextBox = new System.Windows.Forms.TextBox(); | ||
| 42 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); | ||
| 43 | this.tabControl1 = new System.Windows.Forms.TabControl(); | ||
| 44 | this.tabPage1 = new System.Windows.Forms.TabPage(); | ||
| 45 | this.treeViewRequest = new System.Windows.Forms.TreeView(); | ||
| 46 | this.tabPage2 = new System.Windows.Forms.TabPage(); | ||
| 47 | this.panel1 = new System.Windows.Forms.Panel(); | ||
| 48 | this.requestXMLEditor = new System.Windows.Forms.LinkLabel(); | ||
| 49 | this.tableLayoutPanel1.SuspendLayout(); | ||
| 50 | this.tabControl1.SuspendLayout(); | ||
| 51 | this.tabPage1.SuspendLayout(); | ||
| 52 | this.tabPage2.SuspendLayout(); | ||
| 53 | this.panel1.SuspendLayout(); | ||
| 54 | this.SuspendLayout(); | ||
| 55 | // | ||
| 56 | // requestTextBox | ||
| 57 | // | ||
| 58 | this.requestTextBox.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 59 | this.requestTextBox.Location = new System.Drawing.Point(3, 3); | ||
| 60 | this.requestTextBox.Multiline = true; | ||
| 61 | this.requestTextBox.Name = "requestTextBox"; | ||
| 62 | this.requestTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; | ||
| 63 | this.requestTextBox.Size = new System.Drawing.Size(326, 166); | ||
| 64 | this.requestTextBox.TabIndex = 0; | ||
| 65 | this.requestTextBox.WordWrap = false; | ||
| 66 | // | ||
| 67 | // tableLayoutPanel1 | ||
| 68 | // | ||
| 69 | this.tableLayoutPanel1.ColumnCount = 1; | ||
| 70 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); | ||
| 71 | this.tableLayoutPanel1.Controls.Add(this.tabControl1, 0, 1); | ||
| 72 | this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0); | ||
| 73 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 74 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); | ||
| 75 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; | ||
| 76 | this.tableLayoutPanel1.RowCount = 2; | ||
| 77 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); | ||
| 78 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); | ||
| 79 | this.tableLayoutPanel1.Size = new System.Drawing.Size(346, 229); | ||
| 80 | this.tableLayoutPanel1.TabIndex = 1; | ||
| 81 | // | ||
| 82 | // tabControl1 | ||
| 83 | // | ||
| 84 | this.tabControl1.Controls.Add(this.tabPage1); | ||
| 85 | this.tabControl1.Controls.Add(this.tabPage2); | ||
| 86 | this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 87 | this.tabControl1.Location = new System.Drawing.Point(3, 28); | ||
| 88 | this.tabControl1.Name = "tabControl1"; | ||
| 89 | this.tabControl1.SelectedIndex = 0; | ||
| 90 | this.tabControl1.Size = new System.Drawing.Size(340, 198); | ||
| 91 | this.tabControl1.TabIndex = 0; | ||
| 92 | // | ||
| 93 | // tabPage1 | ||
| 94 | // | ||
| 95 | this.tabPage1.Controls.Add(this.treeViewRequest); | ||
| 96 | this.tabPage1.Location = new System.Drawing.Point(4, 22); | ||
| 97 | this.tabPage1.Name = "tabPage1"; | ||
| 98 | this.tabPage1.Padding = new System.Windows.Forms.Padding(3); | ||
| 99 | this.tabPage1.Size = new System.Drawing.Size(332, 172); | ||
| 100 | this.tabPage1.TabIndex = 0; | ||
| 101 | this.tabPage1.Text = "TreeView"; | ||
| 102 | this.tabPage1.UseVisualStyleBackColor = true; | ||
| 103 | // | ||
| 104 | // treeViewRequest | ||
| 105 | // | ||
| 106 | this.treeViewRequest.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 107 | this.treeViewRequest.LabelEdit = true; | ||
| 108 | this.treeViewRequest.Location = new System.Drawing.Point(3, 3); | ||
| 109 | this.treeViewRequest.Name = "treeViewRequest"; | ||
| 110 | this.treeViewRequest.Size = new System.Drawing.Size(326, 166); | ||
| 111 | this.treeViewRequest.TabIndex = 0; | ||
| 112 | // | ||
| 113 | // tabPage2 | ||
| 114 | // | ||
| 115 | this.tabPage2.Controls.Add(this.requestTextBox); | ||
| 116 | this.tabPage2.Location = new System.Drawing.Point(4, 22); | ||
| 117 | this.tabPage2.Name = "tabPage2"; | ||
| 118 | this.tabPage2.Padding = new System.Windows.Forms.Padding(3); | ||
| 119 | this.tabPage2.Size = new System.Drawing.Size(332, 172); | ||
| 120 | this.tabPage2.TabIndex = 1; | ||
| 121 | this.tabPage2.Text = "Text View"; | ||
| 122 | this.tabPage2.UseVisualStyleBackColor = true; | ||
| 123 | // | ||
| 124 | // panel1 | ||
| 125 | // | ||
| 126 | this.panel1.Controls.Add(this.requestXMLEditor); | ||
| 127 | this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 128 | this.panel1.Location = new System.Drawing.Point(3, 3); | ||
| 129 | this.panel1.Name = "panel1"; | ||
| 130 | this.panel1.Size = new System.Drawing.Size(340, 19); | ||
| 131 | this.panel1.TabIndex = 1; | ||
| 132 | // | ||
| 133 | // requestXMLEditor | ||
| 134 | // | ||
| 135 | this.requestXMLEditor.AutoSize = true; | ||
| 136 | this.requestXMLEditor.Location = new System.Drawing.Point(4, 4); | ||
| 137 | this.requestXMLEditor.Name = "requestXMLEditor"; | ||
| 138 | this.requestXMLEditor.Size = new System.Drawing.Size(96, 13); | ||
| 139 | this.requestXMLEditor.TabIndex = 0; | ||
| 140 | this.requestXMLEditor.TabStop = true; | ||
| 141 | this.requestXMLEditor.Text = "View in XML Editor"; | ||
| 142 | this.requestXMLEditor.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.requestXMLEditor_LinkClicked); | ||
| 143 | // | ||
| 144 | // UserControl1 | ||
| 145 | // | ||
| 146 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); | ||
| 147 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | ||
| 148 | this.Controls.Add(this.tableLayoutPanel1); | ||
| 149 | this.Name = "UserControl1"; | ||
| 150 | this.Size = new System.Drawing.Size(346, 229); | ||
| 151 | this.tableLayoutPanel1.ResumeLayout(false); | ||
| 152 | this.tabControl1.ResumeLayout(false); | ||
| 153 | this.tabPage1.ResumeLayout(false); | ||
| 154 | this.tabPage2.ResumeLayout(false); | ||
| 155 | this.tabPage2.PerformLayout(); | ||
| 156 | this.panel1.ResumeLayout(false); | ||
| 157 | this.panel1.PerformLayout(); | ||
| 158 | this.ResumeLayout(false); | ||
| 159 | |||
| 160 | } | ||
| 161 | |||
| 162 | #endregion | ||
| 163 | |||
| 164 | private System.Windows.Forms.TextBox requestTextBox; | ||
| 165 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; | ||
| 166 | private System.Windows.Forms.TabControl tabControl1; | ||
| 167 | private System.Windows.Forms.TabPage tabPage1; | ||
| 168 | private System.Windows.Forms.TabPage tabPage2; | ||
| 169 | private System.Windows.Forms.TreeView treeViewRequest; | ||
| 170 | private System.Windows.Forms.Panel panel1; | ||
| 171 | private System.Windows.Forms.LinkLabel requestXMLEditor; | ||
| 172 | } | ||
| 173 | } |
| 1 | //************************************************************************************************* | ||
| 2 | // MessageEditor.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // UI of Editor for Web Service Request Body | ||
| 6 | // The Web Service response can be plain XML or 'application/soap+msbin1' | ||
| 7 | // (binary - used by Silverlight application with WCF RIA) or JSON | ||
| 8 | // | ||
| 9 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 10 | //************************************************************************************************* | ||
| 11 | using System; | ||
| 12 | using System.Collections.Generic; | ||
| 13 | using System.ComponentModel; | ||
| 14 | using System.Drawing; | ||
| 15 | using System.Data; | ||
| 16 | using System.Linq; | ||
| 17 | using System.Text; | ||
| 18 | using System.Windows.Forms; | ||
| 19 | using System.Xml; | ||
| 20 | using WebTest.WebService.Plugin.ResultTab; | ||
| 21 | using WebTest.WebService.Plugin.Runtime; | ||
| 22 | |||
| 23 | namespace WebTest.WebService.Plugin.MessageEditors | ||
| 24 | { | ||
| 25 | internal partial class MessageEditor : UserControl | ||
| 26 | { | ||
| 27 | /// <summary> | ||
| 28 | /// | ||
| 29 | /// </summary> | ||
| 30 | /// <param name="contentHandler">Handler for given content type</param> | ||
| 31 | public MessageEditor(ContentHandler contentHandler) | ||
| 32 | { | ||
| 33 | InitializeComponent(); | ||
| 34 | |||
| 35 | this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.TabChanged); | ||
| 36 | this.xmlTreeView = new XmlTreeView(this.treeViewRequest); | ||
| 37 | |||
| 38 | this.contentHandler = contentHandler; | ||
| 39 | this.xmlTreeView.ShowXML(contentHandler.XmlDocument); | ||
| 40 | this.requestTextBox.Text = contentHandler.XmlString; | ||
| 41 | |||
| 42 | ContextMenu treeContextMenu = new ContextMenu(); | ||
| 43 | this.treeParameterizeMenuItem = new MenuItem("Parameterize"); | ||
| 44 | treeContextMenu.MenuItems.Add(treeParameterizeMenuItem); | ||
| 45 | this.treeViewRequest.ContextMenu = treeContextMenu; | ||
| 46 | |||
| 47 | |||
| 48 | this.treeParameterizeMenuItem.MenuItems.Clear(); | ||
| 49 | this.treeParameterizeMenuItem.MenuItems.Add(new MenuItem("Type Parameter", AddParameter)); | ||
| 50 | |||
| 51 | Connect connect = Connect.GetInstance(); | ||
| 52 | if (connect != null) | ||
| 53 | { | ||
| 54 | this.webTestDetail = connect.GetActiveWebTest(); | ||
| 55 | } | ||
| 56 | requestXMLEditor.Visible = (this.webTestDetail != null); | ||
| 57 | if (this.webTestDetail != null) | ||
| 58 | { | ||
| 59 | List<string> parameters = this.webTestDetail.GetParameterList(); | ||
| 60 | |||
| 61 | foreach (string parameter in parameters) | ||
| 62 | { | ||
| 63 | this.treeParameterizeMenuItem.MenuItems.Add(new MenuItem(parameter, AddParameter)); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | } | ||
| 67 | |||
| 68 | /// <summary> | ||
| 69 | /// Makes sure both tabs are synced with the current changes that are done in Text Box | ||
| 70 | /// </summary> | ||
| 71 | public void UpdateContent() | ||
| 72 | { | ||
| 73 | if (this.tabControl1.SelectedTab.Equals(this.tabPage2)) | ||
| 74 | { | ||
| 75 | this.contentHandler.XmlString = this.requestTextBox.Text; | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| 79 | private void AddParameter(object sender, EventArgs e) | ||
| 80 | { | ||
| 81 | MenuItem menuItem = sender as MenuItem; | ||
| 82 | if (menuItem == null) | ||
| 83 | { | ||
| 84 | return; | ||
| 85 | } | ||
| 86 | this.xmlTreeView.AddParameter(menuItem.Text); | ||
| 87 | } | ||
| 88 | |||
| 89 | private void TabChanged(object sender, EventArgs e) | ||
| 90 | { | ||
| 91 | if (this.tabControl1.SelectedTab.Equals(this.tabPage1)) | ||
| 92 | { | ||
| 93 | this.contentHandler.XmlString = this.requestTextBox.Text; | ||
| 94 | xmlTreeView.ShowXML(this.contentHandler.XmlDocument); | ||
| 95 | } | ||
| 96 | else | ||
| 97 | { | ||
| 98 | this.requestTextBox.Text = this.contentHandler.XmlString; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | |||
| 102 | private void requestXMLEditor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) | ||
| 103 | { | ||
| 104 | Connect.GetInstance().ShowInXMLEditor("Request Content", this.requestTextBox.Text); | ||
| 105 | } | ||
| 106 | |||
| 107 | private ContentHandler contentHandler; | ||
| 108 | |||
| 109 | private WebTestDetail webTestDetail; | ||
| 110 | private XmlTreeView xmlTreeView; | ||
| 111 | private MenuItem treeParameterizeMenuItem; | ||
| 112 | } | ||
| 113 | } |
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <root> | ||
| 3 | <!-- | ||
| 4 | Microsoft ResX Schema | ||
| 5 | |||
| 6 | Version 2.0 | ||
| 7 | |||
| 8 | The primary goals of this format is to allow a simple XML format | ||
| 9 | that is mostly human readable. The generation and parsing of the | ||
| 10 | various data types are done through the TypeConverter classes | ||
| 11 | associated with the data types. | ||
| 12 | |||
| 13 | Example: | ||
| 14 | |||
| 15 | ... ado.net/XML headers & schema ... | ||
| 16 | <resheader name="resmimetype">text/microsoft-resx</resheader> | ||
| 17 | <resheader name="version">2.0</resheader> | ||
| 18 | <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||
| 19 | <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||
| 20 | <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||
| 21 | <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||
| 22 | <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||
| 23 | <value>[base64 mime encoded serialized .NET Framework object]</value> | ||
| 24 | </data> | ||
| 25 | <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
| 26 | <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||
| 27 | <comment>This is a comment</comment> | ||
| 28 | </data> | ||
| 29 | |||
| 30 | There are any number of "resheader" rows that contain simple | ||
| 31 | name/value pairs. | ||
| 32 | |||
| 33 | Each data row contains a name, and value. The row also contains a | ||
| 34 | type or mimetype. Type corresponds to a .NET class that support | ||
| 35 | text/value conversion through the TypeConverter architecture. | ||
| 36 | Classes that don't support this are serialized and stored with the | ||
| 37 | mimetype set. | ||
| 38 | |||
| 39 | The mimetype is used for serialized objects, and tells the | ||
| 40 | ResXResourceReader how to depersist the object. This is currently not | ||
| 41 | extensible. For a given mimetype the value must be set accordingly: | ||
| 42 | |||
| 43 | Note - application/x-microsoft.net.object.binary.base64 is the format | ||
| 44 | that the ResXResourceWriter will generate, however the reader can | ||
| 45 | read any of the formats listed below. | ||
| 46 | |||
| 47 | mimetype: application/x-microsoft.net.object.binary.base64 | ||
| 48 | value : The object must be serialized with | ||
| 49 | : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||
| 50 | : and then encoded with base64 encoding. | ||
| 51 | |||
| 52 | mimetype: application/x-microsoft.net.object.soap.base64 | ||
| 53 | value : The object must be serialized with | ||
| 54 | : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||
| 55 | : and then encoded with base64 encoding. | ||
| 56 | |||
| 57 | mimetype: application/x-microsoft.net.object.bytearray.base64 | ||
| 58 | value : The object must be serialized into a byte array | ||
| 59 | : using a System.ComponentModel.TypeConverter | ||
| 60 | : and then encoded with base64 encoding. | ||
| 61 | --> | ||
| 62 | <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
| 63 | <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||
| 64 | <xsd:element name="root" msdata:IsDataSet="true"> | ||
| 65 | <xsd:complexType> | ||
| 66 | <xsd:choice maxOccurs="unbounded"> | ||
| 67 | <xsd:element name="metadata"> | ||
| 68 | <xsd:complexType> | ||
| 69 | <xsd:sequence> | ||
| 70 | <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
| 71 | </xsd:sequence> | ||
| 72 | <xsd:attribute name="name" use="required" type="xsd:string" /> | ||
| 73 | <xsd:attribute name="type" type="xsd:string" /> | ||
| 74 | <xsd:attribute name="mimetype" type="xsd:string" /> | ||
| 75 | <xsd:attribute ref="xml:space" /> | ||
| 76 | </xsd:complexType> | ||
| 77 | </xsd:element> | ||
| 78 | <xsd:element name="assembly"> | ||
| 79 | <xsd:complexType> | ||
| 80 | <xsd:attribute name="alias" type="xsd:string" /> | ||
| 81 | <xsd:attribute name="name" type="xsd:string" /> | ||
| 82 | </xsd:complexType> | ||
| 83 | </xsd:element> | ||
| 84 | <xsd:element name="data"> | ||
| 85 | <xsd:complexType> | ||
| 86 | <xsd:sequence> | ||
| 87 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
| 88 | <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
| 89 | </xsd:sequence> | ||
| 90 | <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||
| 91 | <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
| 92 | <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
| 93 | <xsd:attribute ref="xml:space" /> | ||
| 94 | </xsd:complexType> | ||
| 95 | </xsd:element> | ||
| 96 | <xsd:element name="resheader"> | ||
| 97 | <xsd:complexType> | ||
| 98 | <xsd:sequence> | ||
| 99 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
| 100 | </xsd:sequence> | ||
| 101 | <xsd:attribute name="name" type="xsd:string" use="required" /> | ||
| 102 | </xsd:complexType> | ||
| 103 | </xsd:element> | ||
| 104 | </xsd:choice> | ||
| 105 | </xsd:complexType> | ||
| 106 | </xsd:element> | ||
| 107 | </xsd:schema> | ||
| 108 | <resheader name="resmimetype"> | ||
| 109 | <value>text/microsoft-resx</value> | ||
| 110 | </resheader> | ||
| 111 | <resheader name="version"> | ||
| 112 | <value>2.0</value> | ||
| 113 | </resheader> | ||
| 114 | <resheader name="reader"> | ||
| 115 | <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
| 116 | </resheader> | ||
| 117 | <resheader name="writer"> | ||
| 118 | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
| 119 | </resheader> | ||
| 120 | </root> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | //************************************************************************************************* | ||
| 2 | // Msbin1MessageEditor.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // Web Test Plugin for editing 'application/soap+msbin1' content type Web Service Requests | ||
| 6 | // (used by Silverlight application with WCF RIA) | ||
| 7 | // | ||
| 8 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 9 | //************************************************************************************************* | ||
| 10 | using Microsoft.VisualStudio.TestTools.WebTesting; | ||
| 11 | using WebTest.WebService.Plugin.ResultTab; | ||
| 12 | using WebTest.WebService.Plugin.Runtime; | ||
| 13 | |||
| 14 | namespace WebTest.WebService.Plugin.MessageEditors | ||
| 15 | { | ||
| 16 | /// <summary> | ||
| 17 | /// Editor for MSBin1 content type (WCF messages) | ||
| 18 | /// </summary> | ||
| 19 | public class Msbin1MessageEditor : IBinaryHttpBodyEditorPlugin | ||
| 20 | { | ||
| 21 | /// <summary> | ||
| 22 | /// | ||
| 23 | /// </summary> | ||
| 24 | public Msbin1MessageEditor() | ||
| 25 | { | ||
| 26 | } | ||
| 27 | |||
| 28 | /// <summary> | ||
| 29 | /// Determine if this plugin supports a content type. | ||
| 30 | /// </summary> | ||
| 31 | /// <param name="contentType">The content type to test.</param> | ||
| 32 | /// <returns>Returns true if the plugin supports the specified content type.</returns> | ||
| 33 | public bool SupportsContentType(string contentType) | ||
| 34 | { | ||
| 35 | return contentType.ToLower().Contains("msbin1"); | ||
| 36 | } | ||
| 37 | |||
| 38 | /// <summary> | ||
| 39 | /// Create a UserControl to edit the specified bytes. This control will be hosted in the | ||
| 40 | /// plugin dialog which provides OK and Cancel buttons. | ||
| 41 | /// </summary> | ||
| 42 | /// <param name="contentType">The content type of the BinaryHttpBody.</param> | ||
| 43 | /// <param name="initialValue"> | ||
| 44 | /// The bytes to edit. The bytes are the payload of a BinaryHttpBody. | ||
| 45 | /// </param> | ||
| 46 | /// <returns> | ||
| 47 | /// A UserControl capable of displaying and editing the byte array value of | ||
| 48 | /// the specified content type. | ||
| 49 | /// </returns> | ||
| 50 | public object CreateEditor(string contentType, byte[] initialValue) | ||
| 51 | { | ||
| 52 | contentHandler = new Msbin1ContentHandler(contentType.ToLower().Contains("soap")); | ||
| 53 | contentHandler.MessageBytes = initialValue; | ||
| 54 | messageEditor = new MessageEditor(contentHandler); | ||
| 55 | return messageEditor; | ||
| 56 | } | ||
| 57 | |||
| 58 | /// <summary> | ||
| 59 | /// Gets the edited bytes after the OK button is clicked on the plugin dialog. | ||
| 60 | /// </summary> | ||
| 61 | public byte[] GetNewValue() | ||
| 62 | { | ||
| 63 | messageEditor.UpdateContent(); | ||
| 64 | return contentHandler.MessageBytes; | ||
| 65 | } | ||
| 66 | |||
| 67 | private MessageEditor messageEditor = null; | ||
| 68 | private Msbin1ContentHandler contentHandler = null; | ||
| 69 | } | ||
| 70 | } |
| 1 | using System.Reflection; | ||
| 2 | using System.Runtime.CompilerServices; | ||
| 3 | using System.Runtime.InteropServices; | ||
| 4 | |||
| 5 | // General Information about an assembly is controlled through the following | ||
| 6 | // set of attributes. Change these attribute values to modify the information | ||
| 7 | // associated with an assembly. | ||
| 8 | [assembly: AssemblyTitle("ClassLibrary1")] | ||
| 9 | [assembly: AssemblyDescription("")] | ||
| 10 | [assembly: AssemblyConfiguration("")] | ||
| 11 | [assembly: AssemblyCompany("Microsoft IT")] | ||
| 12 | [assembly: AssemblyProduct("ClassLibrary1")] | ||
| 13 | [assembly: AssemblyCopyright("Copyright © Microsoft IT 2010")] | ||
| 14 | [assembly: AssemblyTrademark("")] | ||
| 15 | [assembly: AssemblyCulture("")] | ||
| 16 | |||
| 17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
| 18 | // to COM components. If you need to access a type in this assembly from | ||
| 19 | // COM, set the ComVisible attribute to true on that type. | ||
| 20 | [assembly: ComVisible(false)] | ||
| 21 | |||
| 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
| 23 | [assembly: Guid("fe8ec1e0-7f8a-4935-b5f3-00f482453031")] | ||
| 24 | |||
| 25 | // Version information for an assembly consists of the following four values: | ||
| 26 | // | ||
| 27 | // Major Version | ||
| 28 | // Minor Version | ||
| 29 | // Build Number | ||
| 30 | // Revision | ||
| 31 | // | ||
| 32 | // You can specify all the values or you can default the Build and Revision Numbers | ||
| 33 | // by using the '*' as shown below: | ||
| 34 | // [assembly: AssemblyVersion("1.0.*")] | ||
| 35 | [assembly: AssemblyVersion("1.0.0.0")] | ||
| 36 | [assembly: AssemblyFileVersion("1.0.0.0")] |
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| 3 | <PropertyGroup> | ||
| 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| 5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| 6 | <ProductVersion>8.0.30703</ProductVersion> | ||
| 7 | <SchemaVersion>2.0</SchemaVersion> | ||
| 8 | <ProjectGuid>{23707A49-589B-4A36-BDAA-2896E647D07D}</ProjectGuid> | ||
| 9 | <OutputType>Library</OutputType> | ||
| 10 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
| 11 | <RootNamespace>WebTest.WebService.Plugin.MessageEditors</RootNamespace> | ||
| 12 | <AssemblyName>WebTest.WebService.Plugin.MessageEditors</AssemblyName> | ||
| 13 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
| 14 | <FileAlignment>512</FileAlignment> | ||
| 15 | <SccProjectName>SAK</SccProjectName> | ||
| 16 | <SccLocalPath>SAK</SccLocalPath> | ||
| 17 | <SccAuxPath>SAK</SccAuxPath> | ||
| 18 | <SccProvider>SAK</SccProvider> | ||
| 19 | <TargetFrameworkProfile /> | ||
| 20 | </PropertyGroup> | ||
| 21 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
| 22 | <DebugSymbols>true</DebugSymbols> | ||
| 23 | <DebugType>full</DebugType> | ||
| 24 | <Optimize>false</Optimize> | ||
| 25 | <OutputPath>bin\Debug\</OutputPath> | ||
| 26 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
| 27 | <ErrorReport>prompt</ErrorReport> | ||
| 28 | <WarningLevel>4</WarningLevel> | ||
| 29 | <Prefer32Bit>false</Prefer32Bit> | ||
| 30 | </PropertyGroup> | ||
| 31 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
| 32 | <DebugType>pdbonly</DebugType> | ||
| 33 | <Optimize>true</Optimize> | ||
| 34 | <OutputPath>bin\Release\</OutputPath> | ||
| 35 | <DefineConstants>TRACE</DefineConstants> | ||
| 36 | <ErrorReport>prompt</ErrorReport> | ||
| 37 | <WarningLevel>4</WarningLevel> | ||
| 38 | <Prefer32Bit>false</Prefer32Bit> | ||
| 39 | </PropertyGroup> | ||
| 40 | <ItemGroup> | ||
| 41 | <Reference Include="Extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | ||
| 42 | <EmbedInteropTypes>True</EmbedInteropTypes> | ||
| 43 | </Reference> | ||
| 44 | <Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | ||
| 45 | <Reference Include="System" /> | ||
| 46 | <Reference Include="System.Core" /> | ||
| 47 | <Reference Include="System.Drawing" /> | ||
| 48 | <Reference Include="System.Windows.Forms" /> | ||
| 49 | <Reference Include="System.Xml.Linq" /> | ||
| 50 | <Reference Include="System.Data.DataSetExtensions" /> | ||
| 51 | <Reference Include="Microsoft.CSharp" /> | ||
| 52 | <Reference Include="System.Data" /> | ||
| 53 | <Reference Include="System.Xml" /> | ||
| 54 | </ItemGroup> | ||
| 55 | <ItemGroup> | ||
| 56 | <Compile Include="Msbin1MessageEditor.cs" /> | ||
| 57 | <Compile Include="Properties\AssemblyInfo.cs" /> | ||
| 58 | <Compile Include="MessageEditor.cs"> | ||
| 59 | <SubType>UserControl</SubType> | ||
| 60 | </Compile> | ||
| 61 | <Compile Include="MessageEditor.Designer.cs"> | ||
| 62 | <DependentUpon>MessageEditor.cs</DependentUpon> | ||
| 63 | </Compile> | ||
| 64 | <Compile Include="WebServicePostRecording.cs" /> | ||
| 65 | <Compile Include="XmlMessageEditor.cs" /> | ||
| 66 | </ItemGroup> | ||
| 67 | <ItemGroup> | ||
| 68 | <EmbeddedResource Include="MessageEditor.resx"> | ||
| 69 | <DependentUpon>MessageEditor.cs</DependentUpon> | ||
| 70 | </EmbeddedResource> | ||
| 71 | </ItemGroup> | ||
| 72 | <ItemGroup> | ||
| 73 | <ProjectReference Include="..\WebTestWebServiceResultAddin\WebServicePluginForWebTestResultTab.csproj"> | ||
| 74 | <Project>{48B3509E-1FD8-4875-8FC6-137647EB83AA}</Project> | ||
| 75 | <Name>WebServicePluginForWebTestResultTab</Name> | ||
| 76 | </ProjectReference> | ||
| 77 | <ProjectReference Include="..\WebTestWebServiceRuntime\WebServicePluginForWebTestRuntime.csproj"> | ||
| 78 | <Project>{F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}</Project> | ||
| 79 | <Name>WebServicePluginForWebTestRuntime</Name> | ||
| 80 | </ProjectReference> | ||
| 81 | </ItemGroup> | ||
| 82 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
| 83 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
| 84 | Other similar extension points exist, see Microsoft.Common.targets. | ||
| 85 | <Target Name="BeforeBuild"> | ||
| 86 | </Target> | ||
| 87 | <Target Name="AfterBuild"> | ||
| 88 | </Target> | ||
| 89 | --> | ||
| 90 | </Project> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | //************************************************************************************************* | ||
| 2 | // WebServicePostRecording.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // WebTestRecorderPlugin Implementation: | ||
| 6 | // Web Test Plugin for adding references to the other Web Service plugins | ||
| 7 | // (Extraction/Validation rules etc) to the WebTest after completing recording. | ||
| 8 | // This gets executed if user selects the plugin in the dialog that gets displayed | ||
| 9 | // before a record session. | ||
| 10 | // | ||
| 11 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 12 | //************************************************************************************************* | ||
| 13 | using System.ComponentModel; | ||
| 14 | using Microsoft.VisualStudio.TestTools.WebTesting; | ||
| 15 | using System.Diagnostics.CodeAnalysis; | ||
| 16 | using WebTest.WebService.Plugin.ResultTab; | ||
| 17 | using WebTest.WebService.Plugin.Runtime; | ||
| 18 | |||
| 19 | namespace WebTest.WebService.Plugin.MessageEditors | ||
| 20 | { | ||
| 21 | [DisplayName("Plugin for Web Service Messages")] | ||
| 22 | [Description("XPath extraction/validation rules that extract data from Web Service responses for various content types")] | ||
| 23 | class WebServicePostRecording : WebTestRecorderPlugin | ||
| 24 | { | ||
| 25 | /// <summary> | ||
| 26 | /// Parameters: | ||
| 27 | /// sender: | ||
| 28 | /// The source of the event. | ||
| 29 | /// | ||
| 30 | /// e: | ||
| 31 | /// A Microsoft.VisualStudio.TestTools.WebTesting.PostWebTestRecordingEventArgs | ||
| 32 | /// that contains the event data. | ||
| 33 | /// </summary> | ||
| 34 | /// <param name="sender"></param> | ||
| 35 | /// <param name="e"></param> | ||
| 36 | [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] | ||
| 37 | public override void PostWebTestDynamicParameterDetection(object sender, PostWebTestRecordingEventArgs e) | ||
| 38 | { | ||
| 39 | Connect connect = Connect.GetInstance(); | ||
| 40 | if (connect != null) | ||
| 41 | { | ||
| 42 | connect.AddWebTestRecording(e.RecordedWebTest); | ||
| 43 | } | ||
| 44 | |||
| 45 | bool pluginFound = false; | ||
| 46 | foreach (WebTestPluginReference pluginReference1 in e.RecordedWebTest.WebTestPluginReferences) | ||
| 47 | { | ||
| 48 | if (pluginReference1.Type.ToString().Equals(typeof(WebServicePlugin).ToString())) | ||
| 49 | { | ||
| 50 | pluginFound = true; | ||
| 51 | break; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | if (!pluginFound) | ||
| 56 | { | ||
| 57 | WebTestPluginReference pluginReference = new WebTestPluginReference(); | ||
| 58 | pluginReference.Type = typeof(WebServicePlugin); | ||
| 59 | e.RecordedWebTest.WebTestPluginReferences.Add(pluginReference); | ||
| 60 | } | ||
| 61 | |||
| 62 | // Mark it as modified | ||
| 63 | e.RecordedWebTestModified = true; | ||
| 64 | } | ||
| 65 | } | ||
| 66 | } |
| 1 | //************************************************************************************************* | ||
| 2 | // XmlMessageEditor.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // Web Test Plugin for editing XML string type Web Service Requests | ||
| 6 | // | ||
| 7 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 8 | //************************************************************************************************* | ||
| 9 | using Microsoft.VisualStudio.TestTools.WebTesting; | ||
| 10 | using WebTest.WebService.Plugin.ResultTab; | ||
| 11 | using WebTest.WebService.Plugin.Runtime; | ||
| 12 | |||
| 13 | namespace WebTest.WebService.Plugin.MessageEditors | ||
| 14 | { | ||
| 15 | /// <summary> | ||
| 16 | /// Editor for generic text based hierarchical messages such as XML, JSON etc | ||
| 17 | /// </summary> | ||
| 18 | public class XmlMessageEditor : IStringHttpBodyEditorPlugin | ||
| 19 | { | ||
| 20 | public XmlMessageEditor() | ||
| 21 | { | ||
| 22 | } | ||
| 23 | |||
| 24 | /// <summary> | ||
| 25 | /// Determine if this plugin supports a content type. | ||
| 26 | /// </summary> | ||
| 27 | /// <param name="contentType">The content type to test.</param> | ||
| 28 | /// <returns>Returns true if the plugin supports the specified content type.</returns> | ||
| 29 | public bool SupportsContentType(string contentType) | ||
| 30 | { | ||
| 31 | return (ContentHandlerFactory.GetHandler(contentType) != null); | ||
| 32 | } | ||
| 33 | |||
| 34 | /// <summary> | ||
| 35 | /// Create a UserControl to edit the specified bytes. This control will be hosted in the | ||
| 36 | /// plugin dialog which provides OK and Cancel buttons. | ||
| 37 | /// </summary> | ||
| 38 | /// <param name="contentType">The content type of the BinaryHttpBody.</param> | ||
| 39 | /// <param name="initialValue"> | ||
| 40 | /// The bytes to edit. The bytes are the payload of a BinaryHttpBody. | ||
| 41 | /// </param> | ||
| 42 | /// <returns>A UserControl capable of displaying and editing the byte array | ||
| 43 | /// value of the specified content type. | ||
| 44 | /// </returns> | ||
| 45 | public object CreateEditor(string contentType, string initialValue) | ||
| 46 | { | ||
| 47 | contentHandler = ContentHandlerFactory.GetHandler(contentType); | ||
| 48 | contentHandler.MessageString = initialValue; | ||
| 49 | messageEditor = new MessageEditor(contentHandler); | ||
| 50 | return messageEditor; | ||
| 51 | } | ||
| 52 | |||
| 53 | /// <summary> | ||
| 54 | /// Gets the edited bytes after the OK button is clicked on the plugin dialog. | ||
| 55 | /// </summary> | ||
| 56 | public string GetNewValue() | ||
| 57 | { | ||
| 58 | messageEditor.UpdateContent(); | ||
| 59 | return contentHandler.MessageString; | ||
| 60 | } | ||
| 61 | |||
| 62 | private MessageEditor messageEditor; | ||
| 63 | private ContentHandler contentHandler = null; | ||
| 64 | } | ||
| 65 | } |
WebTestWebServiceResultAddin/AssemblyInfo.cs
0 → 100644
No preview for this file type
WebTestWebServiceResultAddin/Connect.cs
0 → 100644
No preview for this file type
| 1 | //------------------------------------------------------------------------------ | ||
| 2 | // <auto-generated> | ||
| 3 | // This code was generated by a tool. | ||
| 4 | // Runtime Version:4.0.30319.17929 | ||
| 5 | // | ||
| 6 | // Changes to this file may cause incorrect behavior and will be lost if | ||
| 7 | // the code is regenerated. | ||
| 8 | // </auto-generated> | ||
| 9 | //------------------------------------------------------------------------------ | ||
| 10 | |||
| 11 | namespace WebTest.WebService.Plugin.ResultTab.Properties { | ||
| 12 | using System; | ||
| 13 | |||
| 14 | |||
| 15 | /// <summary> | ||
| 16 | /// A strongly-typed resource class, for looking up localized strings, etc. | ||
| 17 | /// </summary> | ||
| 18 | // This class was auto-generated by the StronglyTypedResourceBuilder | ||
| 19 | // class via a tool like ResGen or Visual Studio. | ||
| 20 | // To add or remove a member, edit your .ResX file then rerun ResGen | ||
| 21 | // with the /str option, or rebuild your VS project. | ||
| 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] | ||
| 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | ||
| 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | ||
| 25 | internal class Resources { | ||
| 26 | |||
| 27 | private static global::System.Resources.ResourceManager resourceMan; | ||
| 28 | |||
| 29 | private static global::System.Globalization.CultureInfo resourceCulture; | ||
| 30 | |||
| 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | ||
| 32 | internal Resources() { | ||
| 33 | } | ||
| 34 | |||
| 35 | /// <summary> | ||
| 36 | /// Returns the cached ResourceManager instance used by this class. | ||
| 37 | /// </summary> | ||
| 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | ||
| 39 | internal static global::System.Resources.ResourceManager ResourceManager { | ||
| 40 | get { | ||
| 41 | if (object.ReferenceEquals(resourceMan, null)) { | ||
| 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WebTest.WebService.Plugin.ResultTab.Properties.Resources", typeof(Resources).Assembly); | ||
| 43 | resourceMan = temp; | ||
| 44 | } | ||
| 45 | return resourceMan; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | /// <summary> | ||
| 50 | /// Overrides the current thread's CurrentUICulture property for all | ||
| 51 | /// resource lookups using this strongly typed resource class. | ||
| 52 | /// </summary> | ||
| 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | ||
| 54 | internal static global::System.Globalization.CultureInfo Culture { | ||
| 55 | get { | ||
| 56 | return resourceCulture; | ||
| 57 | } | ||
| 58 | set { | ||
| 59 | resourceCulture = value; | ||
| 60 | } | ||
| 61 | } | ||
| 62 | } | ||
| 63 | } |
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <root> | ||
| 3 | <!-- | ||
| 4 | Microsoft ResX Schema | ||
| 5 | |||
| 6 | Version 2.0 | ||
| 7 | |||
| 8 | The primary goals of this format is to allow a simple XML format | ||
| 9 | that is mostly human readable. The generation and parsing of the | ||
| 10 | various data types are done through the TypeConverter classes | ||
| 11 | associated with the data types. | ||
| 12 | |||
| 13 | Example: | ||
| 14 | |||
| 15 | ... ado.net/XML headers & schema ... | ||
| 16 | <resheader name="resmimetype">text/microsoft-resx</resheader> | ||
| 17 | <resheader name="version">2.0</resheader> | ||
| 18 | <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||
| 19 | <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||
| 20 | <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||
| 21 | <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||
| 22 | <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||
| 23 | <value>[base64 mime encoded serialized .NET Framework object]</value> | ||
| 24 | </data> | ||
| 25 | <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
| 26 | <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||
| 27 | <comment>This is a comment</comment> | ||
| 28 | </data> | ||
| 29 | |||
| 30 | There are any number of "resheader" rows that contain simple | ||
| 31 | name/value pairs. | ||
| 32 | |||
| 33 | Each data row contains a name, and value. The row also contains a | ||
| 34 | type or mimetype. Type corresponds to a .NET class that support | ||
| 35 | text/value conversion through the TypeConverter architecture. | ||
| 36 | Classes that don't support this are serialized and stored with the | ||
| 37 | mimetype set. | ||
| 38 | |||
| 39 | The mimetype is used for serialized objects, and tells the | ||
| 40 | ResXResourceReader how to depersist the object. This is currently not | ||
| 41 | extensible. For a given mimetype the value must be set accordingly: | ||
| 42 | |||
| 43 | Note - application/x-microsoft.net.object.binary.base64 is the format | ||
| 44 | that the ResXResourceWriter will generate, however the reader can | ||
| 45 | read any of the formats listed below. | ||
| 46 | |||
| 47 | mimetype: application/x-microsoft.net.object.binary.base64 | ||
| 48 | value : The object must be serialized with | ||
| 49 | : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||
| 50 | : and then encoded with base64 encoding. | ||
| 51 | |||
| 52 | mimetype: application/x-microsoft.net.object.soap.base64 | ||
| 53 | value : The object must be serialized with | ||
| 54 | : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||
| 55 | : and then encoded with base64 encoding. | ||
| 56 | |||
| 57 | mimetype: application/x-microsoft.net.object.bytearray.base64 | ||
| 58 | value : The object must be serialized into a byte array | ||
| 59 | : using a System.ComponentModel.TypeConverter | ||
| 60 | : and then encoded with base64 encoding. | ||
| 61 | --> | ||
| 62 | <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
| 63 | <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||
| 64 | <xsd:element name="root" msdata:IsDataSet="true"> | ||
| 65 | <xsd:complexType> | ||
| 66 | <xsd:choice maxOccurs="unbounded"> | ||
| 67 | <xsd:element name="metadata"> | ||
| 68 | <xsd:complexType> | ||
| 69 | <xsd:sequence> | ||
| 70 | <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
| 71 | </xsd:sequence> | ||
| 72 | <xsd:attribute name="name" use="required" type="xsd:string" /> | ||
| 73 | <xsd:attribute name="type" type="xsd:string" /> | ||
| 74 | <xsd:attribute name="mimetype" type="xsd:string" /> | ||
| 75 | <xsd:attribute ref="xml:space" /> | ||
| 76 | </xsd:complexType> | ||
| 77 | </xsd:element> | ||
| 78 | <xsd:element name="assembly"> | ||
| 79 | <xsd:complexType> | ||
| 80 | <xsd:attribute name="alias" type="xsd:string" /> | ||
| 81 | <xsd:attribute name="name" type="xsd:string" /> | ||
| 82 | </xsd:complexType> | ||
| 83 | </xsd:element> | ||
| 84 | <xsd:element name="data"> | ||
| 85 | <xsd:complexType> | ||
| 86 | <xsd:sequence> | ||
| 87 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
| 88 | <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
| 89 | </xsd:sequence> | ||
| 90 | <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||
| 91 | <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
| 92 | <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
| 93 | <xsd:attribute ref="xml:space" /> | ||
| 94 | </xsd:complexType> | ||
| 95 | </xsd:element> | ||
| 96 | <xsd:element name="resheader"> | ||
| 97 | <xsd:complexType> | ||
| 98 | <xsd:sequence> | ||
| 99 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
| 100 | </xsd:sequence> | ||
| 101 | <xsd:attribute name="name" type="xsd:string" use="required" /> | ||
| 102 | </xsd:complexType> | ||
| 103 | </xsd:element> | ||
| 104 | </xsd:choice> | ||
| 105 | </xsd:complexType> | ||
| 106 | </xsd:element> | ||
| 107 | </xsd:schema> | ||
| 108 | <resheader name="resmimetype"> | ||
| 109 | <value>text/microsoft-resx</value> | ||
| 110 | </resheader> | ||
| 111 | <resheader name="version"> | ||
| 112 | <value>2.0</value> | ||
| 113 | </resheader> | ||
| 114 | <resheader name="reader"> | ||
| 115 | <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
| 116 | </resheader> | ||
| 117 | <resheader name="writer"> | ||
| 118 | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
| 119 | </resheader> | ||
| 120 | </root> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
| 3 | <PropertyGroup> | ||
| 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| 5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| 6 | <ProductVersion>8.0.30424</ProductVersion> | ||
| 7 | <SchemaVersion>2.0</SchemaVersion> | ||
| 8 | <ProjectGuid>{48B3509E-1FD8-4875-8FC6-137647EB83AA}</ProjectGuid> | ||
| 9 | <OutputType>Library</OutputType> | ||
| 10 | <StartupObject> | ||
| 11 | </StartupObject> | ||
| 12 | <NoStandardLibraries>false</NoStandardLibraries> | ||
| 13 | <AssemblyName>WebTest.WebService.Plugin.ResultTab</AssemblyName> | ||
| 14 | <DeploymentDirectory>.\bin\</DeploymentDirectory> | ||
| 15 | <SccProjectName>SAK</SccProjectName> | ||
| 16 | <SccLocalPath>SAK</SccLocalPath> | ||
| 17 | <SccAuxPath>SAK</SccAuxPath> | ||
| 18 | <SccProvider>SAK</SccProvider> | ||
| 19 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
| 20 | <TargetFrameworkProfile /> | ||
| 21 | </PropertyGroup> | ||
| 22 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
| 23 | <DebugSymbols>true</DebugSymbols> | ||
| 24 | <Optimize>false</Optimize> | ||
| 25 | <OutputPath>.\bin\Debug\</OutputPath> | ||
| 26 | <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging> | ||
| 27 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
| 28 | <WarningLevel>4</WarningLevel> | ||
| 29 | <IncrementalBuild>false</IncrementalBuild> | ||
| 30 | <DocumentationFile>WebTest.WebService.Plugin.ResultTab.xml</DocumentationFile> | ||
| 31 | <Prefer32Bit>false</Prefer32Bit> | ||
| 32 | </PropertyGroup> | ||
| 33 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
| 34 | <DebugSymbols>false</DebugSymbols> | ||
| 35 | <Optimize>true</Optimize> | ||
| 36 | <OutputPath>.\bin\Release\</OutputPath> | ||
| 37 | <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging> | ||
| 38 | <DefineConstants>TRACE</DefineConstants> | ||
| 39 | <WarningLevel>4</WarningLevel> | ||
| 40 | <IncrementalBuild>false</IncrementalBuild> | ||
| 41 | <DocumentationFile>WebTest.WebService.Plugin.ResultTab.xml</DocumentationFile> | ||
| 42 | <Prefer32Bit>false</Prefer32Bit> | ||
| 43 | </PropertyGroup> | ||
| 44 | <PropertyGroup> | ||
| 45 | <RootNamespace>WebTest.WebService.Plugin.ResultTab</RootNamespace> | ||
| 46 | </PropertyGroup> | ||
| 47 | <ItemGroup> | ||
| 48 | <Reference Include="Extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | ||
| 49 | <EmbedInteropTypes>False</EmbedInteropTypes> | ||
| 50 | </Reference> | ||
| 51 | <Reference Include="Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | ||
| 52 | <EmbedInteropTypes>True</EmbedInteropTypes> | ||
| 53 | </Reference> | ||
| 54 | <Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestFramework" /> | ||
| 55 | <Reference Include="Microsoft.VisualStudio.QualityTools.LoadTestPackage"> | ||
| 56 | <HintPath>C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll</HintPath> | ||
| 57 | <HintPath>C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.LoadTestPackage.dll</HintPath> | ||
| 58 | <Private>False</Private> | ||
| 59 | </Reference> | ||
| 60 | <Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework" /> | ||
| 61 | <Reference Include="System" /> | ||
| 62 | <Reference Include="System.Core" /> | ||
| 63 | <Reference Include="System.Data" /> | ||
| 64 | <Reference Include="System.Drawing" /> | ||
| 65 | <Reference Include="System.Windows.Forms" /> | ||
| 66 | <Reference Include="System.Xml" /> | ||
| 67 | <Reference Include="Microsoft.CSharp" /> | ||
| 68 | <Reference Include="Microsoft.VisualStudio.Shell.11.0" /> | ||
| 69 | <Reference Include="Microsoft.VisualStudio.Shell.Immutable.11.0" /> | ||
| 70 | <Reference Include="Microsoft.VisualStudio.OLE.Interop" /> | ||
| 71 | <Reference Include="Microsoft.VisualStudio.Shell.Interop" /> | ||
| 72 | <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" /> | ||
| 73 | <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" /> | ||
| 74 | <Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" /> | ||
| 75 | <Reference Include="VSLangProj, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | ||
| 76 | <EmbedInteropTypes>True</EmbedInteropTypes> | ||
| 77 | </Reference> | ||
| 78 | <Reference Include="VSLangProj2, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | ||
| 79 | <EmbedInteropTypes>True</EmbedInteropTypes> | ||
| 80 | </Reference> | ||
| 81 | <Reference Include="VSLangProj80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | ||
| 82 | <EmbedInteropTypes>True</EmbedInteropTypes> | ||
| 83 | </Reference> | ||
| 84 | </ItemGroup> | ||
| 85 | <ItemGroup> | ||
| 86 | <Compile Include="AssemblyInfo.cs"> | ||
| 87 | <SubType>Code</SubType> | ||
| 88 | </Compile> | ||
| 89 | <Compile Include="Connect.cs"> | ||
| 90 | <SubType>Code</SubType> | ||
| 91 | </Compile> | ||
| 92 | <Compile Include="Properties\Resources.Designer.cs"> | ||
| 93 | <AutoGen>True</AutoGen> | ||
| 94 | <DesignTime>True</DesignTime> | ||
| 95 | <DependentUpon>Resources.resx</DependentUpon> | ||
| 96 | </Compile> | ||
| 97 | <Compile Include="WebServiceResult.cs"> | ||
| 98 | <SubType>UserControl</SubType> | ||
| 99 | </Compile> | ||
| 100 | <Compile Include="WebServiceResult.Designer.cs"> | ||
| 101 | <DependentUpon>WebServiceResult.cs</DependentUpon> | ||
| 102 | </Compile> | ||
| 103 | <Compile Include="WebTestDetail.cs" /> | ||
| 104 | <Compile Include="XmlTreeView.cs" /> | ||
| 105 | </ItemGroup> | ||
| 106 | <ItemGroup> | ||
| 107 | <COMReference Include="EnvDTE"> | ||
| 108 | <Guid>{80CC9F66-E7D8-4DDD-85B6-D9E6CD0E93E2}</Guid> | ||
| 109 | <VersionMajor>8</VersionMajor> | ||
| 110 | <VersionMinor>0</VersionMinor> | ||
| 111 | <Lcid>0</Lcid> | ||
| 112 | <WrapperTool>primary</WrapperTool> | ||
| 113 | <Isolated>False</Isolated> | ||
| 114 | <EmbedInteropTypes>False</EmbedInteropTypes> | ||
| 115 | </COMReference> | ||
| 116 | <COMReference Include="EnvDTE100"> | ||
| 117 | <Guid>{26AD1324-4B7C-44BC-84F8-B86AED45729F}</Guid> | ||
| 118 | <VersionMajor>10</VersionMajor> | ||
| 119 | <VersionMinor>0</VersionMinor> | ||
| 120 | <Lcid>0</Lcid> | ||
| 121 | <WrapperTool>primary</WrapperTool> | ||
| 122 | <Isolated>False</Isolated> | ||
| 123 | <EmbedInteropTypes>False</EmbedInteropTypes> | ||
| 124 | </COMReference> | ||
| 125 | <COMReference Include="EnvDTE80"> | ||
| 126 | <Guid>{1A31287A-4D7D-413E-8E32-3B374931BD89}</Guid> | ||
| 127 | <VersionMajor>8</VersionMajor> | ||
| 128 | <VersionMinor>0</VersionMinor> | ||
| 129 | <Lcid>0</Lcid> | ||
| 130 | <WrapperTool>primary</WrapperTool> | ||
| 131 | <Isolated>False</Isolated> | ||
| 132 | <EmbedInteropTypes>False</EmbedInteropTypes> | ||
| 133 | </COMReference> | ||
| 134 | <COMReference Include="EnvDTE90"> | ||
| 135 | <Guid>{2CE2370E-D744-4936-A090-3FFFE667B0E1}</Guid> | ||
| 136 | <VersionMajor>9</VersionMajor> | ||
| 137 | <VersionMinor>0</VersionMinor> | ||
| 138 | <Lcid>0</Lcid> | ||
| 139 | <WrapperTool>primary</WrapperTool> | ||
| 140 | <Isolated>False</Isolated> | ||
| 141 | <EmbedInteropTypes>False</EmbedInteropTypes> | ||
| 142 | </COMReference> | ||
| 143 | <COMReference Include="Microsoft.VisualStudio.CommandBars"> | ||
| 144 | <Guid>{1CBA492E-7263-47BB-87FE-639000619B15}</Guid> | ||
| 145 | <VersionMajor>8</VersionMajor> | ||
| 146 | <VersionMinor>0</VersionMinor> | ||
| 147 | <Lcid>0</Lcid> | ||
| 148 | <WrapperTool>primary</WrapperTool> | ||
| 149 | <Isolated>False</Isolated> | ||
| 150 | <EmbedInteropTypes>False</EmbedInteropTypes> | ||
| 151 | </COMReference> | ||
| 152 | <COMReference Include="stdole"> | ||
| 153 | <Guid>{00020430-0000-0000-C000-000000000046}</Guid> | ||
| 154 | <VersionMajor>2</VersionMajor> | ||
| 155 | <VersionMinor>0</VersionMinor> | ||
| 156 | <Lcid>0</Lcid> | ||
| 157 | <WrapperTool>primary</WrapperTool> | ||
| 158 | <Isolated>False</Isolated> | ||
| 159 | <EmbedInteropTypes>False</EmbedInteropTypes> | ||
| 160 | </COMReference> | ||
| 161 | </ItemGroup> | ||
| 162 | <ItemGroup> | ||
| 163 | <Content Include="WebServicePluginForWebTestResultTab.AddIn"> | ||
| 164 | <SubType>Designer</SubType> | ||
| 165 | </Content> | ||
| 166 | </ItemGroup> | ||
| 167 | <ItemGroup> | ||
| 168 | <EmbeddedResource Include="Properties\Resources.resx"> | ||
| 169 | <Generator>ResXFileCodeGenerator</Generator> | ||
| 170 | <LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
| 171 | </EmbeddedResource> | ||
| 172 | <EmbeddedResource Include="WebServiceResult.resx"> | ||
| 173 | <DependentUpon>WebServiceResult.cs</DependentUpon> | ||
| 174 | </EmbeddedResource> | ||
| 175 | </ItemGroup> | ||
| 176 | <ItemGroup> | ||
| 177 | <ProjectReference Include="..\WebTestWebServiceRuntime\WebServicePluginForWebTestRuntime.csproj"> | ||
| 178 | <Project>{F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}</Project> | ||
| 179 | <Name>WebServicePluginForWebTestRuntime</Name> | ||
| 180 | <Private>False</Private> | ||
| 181 | </ProjectReference> | ||
| 182 | </ItemGroup> | ||
| 183 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
| 184 | <PropertyGroup> | ||
| 185 | <PreBuildEvent> | ||
| 186 | </PreBuildEvent> | ||
| 187 | <PostBuildEvent> | ||
| 188 | </PostBuildEvent> | ||
| 189 | </PropertyGroup> | ||
| 190 | <ProjectExtensions /> | ||
| 191 | <Target Name="AfterBuild"> | ||
| 192 | <PropertyGroup> | ||
| 193 | <DllName>$(AssemblyName).dll</DllName> | ||
| 194 | <PdbName>$(AssemblyName).pdb</PdbName> | ||
| 195 | <DocFileName>$(AssemblyName).xml</DocFileName> | ||
| 196 | </PropertyGroup> | ||
| 197 | <Delete Condition="Exists('$(DeploymentDirectory)$(DllName)')" Files="$(DeploymentDirectory)$(DllName)"> | ||
| 198 | </Delete> | ||
| 199 | <Delete Condition="Exists('$(DeploymentDirectory)$(PdbName)')" Files="$(DeploymentDirectory)$(PdbName)"> | ||
| 200 | </Delete> | ||
| 201 | <Delete Condition="Exists('$(DeploymentDirectory)$(DocFileName)')" Files="$(DeploymentDirectory)$(DocFileName)"> | ||
| 202 | </Delete> | ||
| 203 | <Copy Condition="Exists('$(OutputPath)$(DllName)')" SourceFiles="$(OutputPath)$(DllName)" DestinationFolder="$(DeploymentDirectory)"> | ||
| 204 | <Output TaskParameter="DestinationFiles" ItemName="FileWrites" /> | ||
| 205 | </Copy> | ||
| 206 | <Copy Condition="Exists('$(OutputPath)$(PdbName)')" SourceFiles="$(OutputPath)$(PdbName)" DestinationFolder="$(DeploymentDirectory)"> | ||
| 207 | <Output TaskParameter="DestinationFiles" ItemName="FileWrites" /> | ||
| 208 | </Copy> | ||
| 209 | <Copy Condition="Exists('$(OutputPath)$(DocFileName)')" SourceFiles="$(OutputPath)$(DocFileName)" DestinationFolder="$(DeploymentDirectory)"> | ||
| 210 | <Output TaskParameter="DestinationFiles" ItemName="FileWrites" /> | ||
| 211 | </Copy> | ||
| 212 | </Target> | ||
| 213 | </Project> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | namespace WebTest.WebService.Plugin.ResultTab | ||
| 2 | { | ||
| 3 | partial class WebServiceResult | ||
| 4 | { | ||
| 5 | /// <summary> | ||
| 6 | /// Required designer variable. | ||
| 7 | /// </summary> | ||
| 8 | private System.ComponentModel.IContainer components = null; | ||
| 9 | |||
| 10 | /// <summary> | ||
| 11 | /// Clean up any resources being used. | ||
| 12 | /// </summary> | ||
| 13 | /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | ||
| 14 | protected override void Dispose(bool disposing) | ||
| 15 | { | ||
| 16 | if (disposing && (components != null)) | ||
| 17 | { | ||
| 18 | components.Dispose(); | ||
| 19 | } | ||
| 20 | base.Dispose(disposing); | ||
| 21 | } | ||
| 22 | |||
| 23 | #region Component Designer generated code | ||
| 24 | |||
| 25 | /// <summary> | ||
| 26 | /// Required method for Designer support - do not modify | ||
| 27 | /// the contents of this method with the code editor. | ||
| 28 | /// </summary> | ||
| 29 | private void InitializeComponent() | ||
| 30 | { | ||
| 31 | this.splitContainer1 = new System.Windows.Forms.SplitContainer(); | ||
| 32 | this.groupBox1 = new System.Windows.Forms.GroupBox(); | ||
| 33 | this.panel1 = new System.Windows.Forms.Panel(); | ||
| 34 | this.requestXMLEditor = new System.Windows.Forms.LinkLabel(); | ||
| 35 | this.updateLinkLabel = new System.Windows.Forms.LinkLabel(); | ||
| 36 | this.editRequest = new System.Windows.Forms.CheckBox(); | ||
| 37 | this.RequestTab = new System.Windows.Forms.TabControl(); | ||
| 38 | this.RequestTabPageTextView = new System.Windows.Forms.TabPage(); | ||
| 39 | this.requestTextBox = new System.Windows.Forms.TextBox(); | ||
| 40 | this.RequestTabPageTreeView = new System.Windows.Forms.TabPage(); | ||
| 41 | this.treeViewRequest = new System.Windows.Forms.TreeView(); | ||
| 42 | this.groupBox2 = new System.Windows.Forms.GroupBox(); | ||
| 43 | this.panel2 = new System.Windows.Forms.Panel(); | ||
| 44 | this.responseXMLEditor = new System.Windows.Forms.LinkLabel(); | ||
| 45 | this.ResponseTab = new System.Windows.Forms.TabControl(); | ||
| 46 | this.ResponseTabPageTextView = new System.Windows.Forms.TabPage(); | ||
| 47 | this.responseTextBox = new System.Windows.Forms.TextBox(); | ||
| 48 | this.ResponseTabPageTreeView = new System.Windows.Forms.TabPage(); | ||
| 49 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); | ||
| 50 | this.treeViewResponse = new System.Windows.Forms.TreeView(); | ||
| 51 | this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); | ||
| 52 | this.XPathButton = new System.Windows.Forms.Button(); | ||
| 53 | this.XPathTextBox = new System.Windows.Forms.TextBox(); | ||
| 54 | this.label1 = new System.Windows.Forms.Label(); | ||
| 55 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); | ||
| 56 | this.splitContainer1.Panel1.SuspendLayout(); | ||
| 57 | this.splitContainer1.Panel2.SuspendLayout(); | ||
| 58 | this.splitContainer1.SuspendLayout(); | ||
| 59 | this.groupBox1.SuspendLayout(); | ||
| 60 | this.panel1.SuspendLayout(); | ||
| 61 | this.RequestTab.SuspendLayout(); | ||
| 62 | this.RequestTabPageTextView.SuspendLayout(); | ||
| 63 | this.RequestTabPageTreeView.SuspendLayout(); | ||
| 64 | this.groupBox2.SuspendLayout(); | ||
| 65 | this.panel2.SuspendLayout(); | ||
| 66 | this.ResponseTab.SuspendLayout(); | ||
| 67 | this.ResponseTabPageTextView.SuspendLayout(); | ||
| 68 | this.ResponseTabPageTreeView.SuspendLayout(); | ||
| 69 | this.tableLayoutPanel1.SuspendLayout(); | ||
| 70 | this.tableLayoutPanel2.SuspendLayout(); | ||
| 71 | this.SuspendLayout(); | ||
| 72 | // | ||
| 73 | // splitContainer1 | ||
| 74 | // | ||
| 75 | this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 76 | this.splitContainer1.Location = new System.Drawing.Point(0, 0); | ||
| 77 | this.splitContainer1.Name = "splitContainer1"; | ||
| 78 | // | ||
| 79 | // splitContainer1.Panel1 | ||
| 80 | // | ||
| 81 | this.splitContainer1.Panel1.Controls.Add(this.groupBox1); | ||
| 82 | // | ||
| 83 | // splitContainer1.Panel2 | ||
| 84 | // | ||
| 85 | this.splitContainer1.Panel2.Controls.Add(this.groupBox2); | ||
| 86 | this.splitContainer1.Size = new System.Drawing.Size(649, 237); | ||
| 87 | this.splitContainer1.SplitterDistance = 340; | ||
| 88 | this.splitContainer1.TabIndex = 0; | ||
| 89 | // | ||
| 90 | // groupBox1 | ||
| 91 | // | ||
| 92 | this.groupBox1.Controls.Add(this.panel1); | ||
| 93 | this.groupBox1.Controls.Add(this.RequestTab); | ||
| 94 | this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 95 | this.groupBox1.Location = new System.Drawing.Point(0, 0); | ||
| 96 | this.groupBox1.Name = "groupBox1"; | ||
| 97 | this.groupBox1.Size = new System.Drawing.Size(340, 237); | ||
| 98 | this.groupBox1.TabIndex = 0; | ||
| 99 | this.groupBox1.TabStop = false; | ||
| 100 | this.groupBox1.Text = "Request"; | ||
| 101 | // | ||
| 102 | // panel1 | ||
| 103 | // | ||
| 104 | this.panel1.Controls.Add(this.requestXMLEditor); | ||
| 105 | this.panel1.Controls.Add(this.updateLinkLabel); | ||
| 106 | this.panel1.Controls.Add(this.editRequest); | ||
| 107 | this.panel1.Location = new System.Drawing.Point(125, 9); | ||
| 108 | this.panel1.Name = "panel1"; | ||
| 109 | this.panel1.Size = new System.Drawing.Size(198, 26); | ||
| 110 | this.panel1.TabIndex = 1; | ||
| 111 | // | ||
| 112 | // requestXMLEditor | ||
| 113 | // | ||
| 114 | this.requestXMLEditor.AutoSize = true; | ||
| 115 | this.requestXMLEditor.Location = new System.Drawing.Point(3, 5); | ||
| 116 | this.requestXMLEditor.Name = "requestXMLEditor"; | ||
| 117 | this.requestXMLEditor.Size = new System.Drawing.Size(96, 13); | ||
| 118 | this.requestXMLEditor.TabIndex = 5; | ||
| 119 | this.requestXMLEditor.TabStop = true; | ||
| 120 | this.requestXMLEditor.Text = "View in XML Editor"; | ||
| 121 | this.requestXMLEditor.Visible = false; | ||
| 122 | this.requestXMLEditor.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.requestXMLEditor_LinkClicked); | ||
| 123 | // | ||
| 124 | // updateLinkLabel | ||
| 125 | // | ||
| 126 | this.updateLinkLabel.AutoSize = true; | ||
| 127 | this.updateLinkLabel.Location = new System.Drawing.Point(153, 4); | ||
| 128 | this.updateLinkLabel.Name = "updateLinkLabel"; | ||
| 129 | this.updateLinkLabel.Size = new System.Drawing.Size(42, 13); | ||
| 130 | this.updateLinkLabel.TabIndex = 4; | ||
| 131 | this.updateLinkLabel.TabStop = true; | ||
| 132 | this.updateLinkLabel.Text = "Update"; | ||
| 133 | this.updateLinkLabel.Visible = false; | ||
| 134 | this.updateLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.updateLinkLabel_LinkClicked); | ||
| 135 | // | ||
| 136 | // editRequest | ||
| 137 | // | ||
| 138 | this.editRequest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | ||
| 139 | this.editRequest.AutoSize = true; | ||
| 140 | this.editRequest.Location = new System.Drawing.Point(115, 4); | ||
| 141 | this.editRequest.Name = "editRequest"; | ||
| 142 | this.editRequest.Size = new System.Drawing.Size(44, 17); | ||
| 143 | this.editRequest.TabIndex = 2; | ||
| 144 | this.editRequest.Text = "Edit"; | ||
| 145 | this.editRequest.UseVisualStyleBackColor = true; | ||
| 146 | this.editRequest.Visible = false; | ||
| 147 | // | ||
| 148 | // RequestTab | ||
| 149 | // | ||
| 150 | this.RequestTab.Controls.Add(this.RequestTabPageTextView); | ||
| 151 | this.RequestTab.Controls.Add(this.RequestTabPageTreeView); | ||
| 152 | this.RequestTab.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 153 | this.RequestTab.Location = new System.Drawing.Point(3, 16); | ||
| 154 | this.RequestTab.Name = "RequestTab"; | ||
| 155 | this.RequestTab.SelectedIndex = 0; | ||
| 156 | this.RequestTab.Size = new System.Drawing.Size(334, 218); | ||
| 157 | this.RequestTab.TabIndex = 1; | ||
| 158 | this.RequestTab.SelectedIndexChanged += new System.EventHandler(this.RequestTabChanged); | ||
| 159 | // | ||
| 160 | // RequestTabPageTextView | ||
| 161 | // | ||
| 162 | this.RequestTabPageTextView.Controls.Add(this.requestTextBox); | ||
| 163 | this.RequestTabPageTextView.Location = new System.Drawing.Point(4, 22); | ||
| 164 | this.RequestTabPageTextView.Name = "RequestTabPageTextView"; | ||
| 165 | this.RequestTabPageTextView.Padding = new System.Windows.Forms.Padding(3); | ||
| 166 | this.RequestTabPageTextView.Size = new System.Drawing.Size(326, 192); | ||
| 167 | this.RequestTabPageTextView.TabIndex = 0; | ||
| 168 | this.RequestTabPageTextView.Text = "Text View"; | ||
| 169 | this.RequestTabPageTextView.UseVisualStyleBackColor = true; | ||
| 170 | // | ||
| 171 | // requestTextBox | ||
| 172 | // | ||
| 173 | this.requestTextBox.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 174 | this.requestTextBox.Location = new System.Drawing.Point(3, 3); | ||
| 175 | this.requestTextBox.Multiline = true; | ||
| 176 | this.requestTextBox.Name = "requestTextBox"; | ||
| 177 | this.requestTextBox.ReadOnly = true; | ||
| 178 | this.requestTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; | ||
| 179 | this.requestTextBox.Size = new System.Drawing.Size(320, 186); | ||
| 180 | this.requestTextBox.TabIndex = 0; | ||
| 181 | this.requestTextBox.WordWrap = false; | ||
| 182 | // | ||
| 183 | // RequestTabPageTreeView | ||
| 184 | // | ||
| 185 | this.RequestTabPageTreeView.Controls.Add(this.treeViewRequest); | ||
| 186 | this.RequestTabPageTreeView.Location = new System.Drawing.Point(4, 22); | ||
| 187 | this.RequestTabPageTreeView.Name = "RequestTabPageTreeView"; | ||
| 188 | this.RequestTabPageTreeView.Padding = new System.Windows.Forms.Padding(3); | ||
| 189 | this.RequestTabPageTreeView.Size = new System.Drawing.Size(326, 192); | ||
| 190 | this.RequestTabPageTreeView.TabIndex = 1; | ||
| 191 | this.RequestTabPageTreeView.Text = "Tree View"; | ||
| 192 | this.RequestTabPageTreeView.UseVisualStyleBackColor = true; | ||
| 193 | // | ||
| 194 | // treeViewRequest | ||
| 195 | // | ||
| 196 | this.treeViewRequest.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 197 | this.treeViewRequest.HideSelection = false; | ||
| 198 | this.treeViewRequest.Location = new System.Drawing.Point(3, 3); | ||
| 199 | this.treeViewRequest.Name = "treeViewRequest"; | ||
| 200 | this.treeViewRequest.Size = new System.Drawing.Size(320, 186); | ||
| 201 | this.treeViewRequest.TabIndex = 0; | ||
| 202 | // | ||
| 203 | // groupBox2 | ||
| 204 | // | ||
| 205 | this.groupBox2.Controls.Add(this.panel2); | ||
| 206 | this.groupBox2.Controls.Add(this.ResponseTab); | ||
| 207 | this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 208 | this.groupBox2.Location = new System.Drawing.Point(0, 0); | ||
| 209 | this.groupBox2.Name = "groupBox2"; | ||
| 210 | this.groupBox2.Size = new System.Drawing.Size(305, 237); | ||
| 211 | this.groupBox2.TabIndex = 0; | ||
| 212 | this.groupBox2.TabStop = false; | ||
| 213 | this.groupBox2.Text = "Response"; | ||
| 214 | // | ||
| 215 | // panel2 | ||
| 216 | // | ||
| 217 | this.panel2.Controls.Add(this.responseXMLEditor); | ||
| 218 | this.panel2.Location = new System.Drawing.Point(132, 9); | ||
| 219 | this.panel2.Name = "panel2"; | ||
| 220 | this.panel2.Size = new System.Drawing.Size(115, 23); | ||
| 221 | this.panel2.TabIndex = 1; | ||
| 222 | // | ||
| 223 | // responseXMLEditor | ||
| 224 | // | ||
| 225 | this.responseXMLEditor.AutoSize = true; | ||
| 226 | this.responseXMLEditor.Location = new System.Drawing.Point(3, 7); | ||
| 227 | this.responseXMLEditor.Name = "responseXMLEditor"; | ||
| 228 | this.responseXMLEditor.Size = new System.Drawing.Size(96, 13); | ||
| 229 | this.responseXMLEditor.TabIndex = 0; | ||
| 230 | this.responseXMLEditor.TabStop = true; | ||
| 231 | this.responseXMLEditor.Text = "View in XML Editor"; | ||
| 232 | this.responseXMLEditor.Visible = false; | ||
| 233 | this.responseXMLEditor.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.responseXMLEditor_LinkClicked); | ||
| 234 | // | ||
| 235 | // ResponseTab | ||
| 236 | // | ||
| 237 | this.ResponseTab.Controls.Add(this.ResponseTabPageTextView); | ||
| 238 | this.ResponseTab.Controls.Add(this.ResponseTabPageTreeView); | ||
| 239 | this.ResponseTab.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 240 | this.ResponseTab.Location = new System.Drawing.Point(3, 16); | ||
| 241 | this.ResponseTab.Name = "ResponseTab"; | ||
| 242 | this.ResponseTab.SelectedIndex = 0; | ||
| 243 | this.ResponseTab.Size = new System.Drawing.Size(299, 218); | ||
| 244 | this.ResponseTab.TabIndex = 2; | ||
| 245 | this.ResponseTab.SelectedIndexChanged += new System.EventHandler(this.ResponseTabChanged); | ||
| 246 | // | ||
| 247 | // ResponseTabPageTextView | ||
| 248 | // | ||
| 249 | this.ResponseTabPageTextView.Controls.Add(this.responseTextBox); | ||
| 250 | this.ResponseTabPageTextView.Location = new System.Drawing.Point(4, 22); | ||
| 251 | this.ResponseTabPageTextView.Name = "ResponseTabPageTextView"; | ||
| 252 | this.ResponseTabPageTextView.Padding = new System.Windows.Forms.Padding(3); | ||
| 253 | this.ResponseTabPageTextView.Size = new System.Drawing.Size(291, 192); | ||
| 254 | this.ResponseTabPageTextView.TabIndex = 0; | ||
| 255 | this.ResponseTabPageTextView.Text = "Text View"; | ||
| 256 | this.ResponseTabPageTextView.UseVisualStyleBackColor = true; | ||
| 257 | // | ||
| 258 | // responseTextBox | ||
| 259 | // | ||
| 260 | this.responseTextBox.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 261 | this.responseTextBox.Location = new System.Drawing.Point(3, 3); | ||
| 262 | this.responseTextBox.Multiline = true; | ||
| 263 | this.responseTextBox.Name = "responseTextBox"; | ||
| 264 | this.responseTextBox.ReadOnly = true; | ||
| 265 | this.responseTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; | ||
| 266 | this.responseTextBox.Size = new System.Drawing.Size(285, 186); | ||
| 267 | this.responseTextBox.TabIndex = 0; | ||
| 268 | this.responseTextBox.WordWrap = false; | ||
| 269 | // | ||
| 270 | // ResponseTabPageTreeView | ||
| 271 | // | ||
| 272 | this.ResponseTabPageTreeView.Controls.Add(this.tableLayoutPanel1); | ||
| 273 | this.ResponseTabPageTreeView.Location = new System.Drawing.Point(4, 22); | ||
| 274 | this.ResponseTabPageTreeView.Name = "ResponseTabPageTreeView"; | ||
| 275 | this.ResponseTabPageTreeView.Padding = new System.Windows.Forms.Padding(3); | ||
| 276 | this.ResponseTabPageTreeView.Size = new System.Drawing.Size(291, 192); | ||
| 277 | this.ResponseTabPageTreeView.TabIndex = 1; | ||
| 278 | this.ResponseTabPageTreeView.Text = "Tree View"; | ||
| 279 | this.ResponseTabPageTreeView.UseVisualStyleBackColor = true; | ||
| 280 | // | ||
| 281 | // tableLayoutPanel1 | ||
| 282 | // | ||
| 283 | this.tableLayoutPanel1.ColumnCount = 1; | ||
| 284 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); | ||
| 285 | this.tableLayoutPanel1.Controls.Add(this.treeViewResponse, 0, 0); | ||
| 286 | this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1); | ||
| 287 | this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 288 | this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3); | ||
| 289 | this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); | ||
| 290 | this.tableLayoutPanel1.Name = "tableLayoutPanel1"; | ||
| 291 | this.tableLayoutPanel1.RowCount = 2; | ||
| 292 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); | ||
| 293 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F)); | ||
| 294 | this.tableLayoutPanel1.Size = new System.Drawing.Size(285, 186); | ||
| 295 | this.tableLayoutPanel1.TabIndex = 2; | ||
| 296 | // | ||
| 297 | // treeViewResponse | ||
| 298 | // | ||
| 299 | this.treeViewResponse.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 300 | this.treeViewResponse.HideSelection = false; | ||
| 301 | this.treeViewResponse.Location = new System.Drawing.Point(3, 3); | ||
| 302 | this.treeViewResponse.Name = "treeViewResponse"; | ||
| 303 | this.treeViewResponse.Size = new System.Drawing.Size(279, 153); | ||
| 304 | this.treeViewResponse.TabIndex = 1; | ||
| 305 | // | ||
| 306 | // tableLayoutPanel2 | ||
| 307 | // | ||
| 308 | this.tableLayoutPanel2.ColumnCount = 3; | ||
| 309 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F)); | ||
| 310 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); | ||
| 311 | this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 35F)); | ||
| 312 | this.tableLayoutPanel2.Controls.Add(this.XPathButton, 2, 0); | ||
| 313 | this.tableLayoutPanel2.Controls.Add(this.XPathTextBox, 1, 0); | ||
| 314 | this.tableLayoutPanel2.Controls.Add(this.label1, 0, 0); | ||
| 315 | this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; | ||
| 316 | this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 159); | ||
| 317 | this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); | ||
| 318 | this.tableLayoutPanel2.Name = "tableLayoutPanel2"; | ||
| 319 | this.tableLayoutPanel2.RowCount = 1; | ||
| 320 | this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); | ||
| 321 | this.tableLayoutPanel2.Size = new System.Drawing.Size(285, 27); | ||
| 322 | this.tableLayoutPanel2.TabIndex = 2; | ||
| 323 | // | ||
| 324 | // XPathButton | ||
| 325 | // | ||
| 326 | this.XPathButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); | ||
| 327 | this.XPathButton.Location = new System.Drawing.Point(250, 3); | ||
| 328 | this.XPathButton.Margin = new System.Windows.Forms.Padding(0); | ||
| 329 | this.XPathButton.Name = "XPathButton"; | ||
| 330 | this.XPathButton.Size = new System.Drawing.Size(35, 21); | ||
| 331 | this.XPathButton.TabIndex = 1; | ||
| 332 | this.XPathButton.Text = "Run"; | ||
| 333 | this.XPathButton.UseVisualStyleBackColor = true; | ||
| 334 | this.XPathButton.Click += new System.EventHandler(this.XPathButton_Click); | ||
| 335 | // | ||
| 336 | // XPathTextBox | ||
| 337 | // | ||
| 338 | this.XPathTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | ||
| 339 | | System.Windows.Forms.AnchorStyles.Left) | ||
| 340 | | System.Windows.Forms.AnchorStyles.Right))); | ||
| 341 | this.XPathTextBox.Location = new System.Drawing.Point(43, 3); | ||
| 342 | this.XPathTextBox.Name = "XPathTextBox"; | ||
| 343 | this.XPathTextBox.Size = new System.Drawing.Size(204, 20); | ||
| 344 | this.XPathTextBox.TabIndex = 2; | ||
| 345 | // | ||
| 346 | // label1 | ||
| 347 | // | ||
| 348 | this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); | ||
| 349 | this.label1.AutoSize = true; | ||
| 350 | this.label1.Location = new System.Drawing.Point(3, 7); | ||
| 351 | this.label1.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); | ||
| 352 | this.label1.Name = "label1"; | ||
| 353 | this.label1.Size = new System.Drawing.Size(37, 13); | ||
| 354 | this.label1.TabIndex = 3; | ||
| 355 | this.label1.Text = "XPath"; | ||
| 356 | // | ||
| 357 | // WebServiceResult | ||
| 358 | // | ||
| 359 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); | ||
| 360 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | ||
| 361 | this.Controls.Add(this.splitContainer1); | ||
| 362 | this.Name = "WebServiceResult"; | ||
| 363 | this.Size = new System.Drawing.Size(649, 237); | ||
| 364 | this.splitContainer1.Panel1.ResumeLayout(false); | ||
| 365 | this.splitContainer1.Panel2.ResumeLayout(false); | ||
| 366 | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); | ||
| 367 | this.splitContainer1.ResumeLayout(false); | ||
| 368 | this.groupBox1.ResumeLayout(false); | ||
| 369 | this.panel1.ResumeLayout(false); | ||
| 370 | this.panel1.PerformLayout(); | ||
| 371 | this.RequestTab.ResumeLayout(false); | ||
| 372 | this.RequestTabPageTextView.ResumeLayout(false); | ||
| 373 | this.RequestTabPageTextView.PerformLayout(); | ||
| 374 | this.RequestTabPageTreeView.ResumeLayout(false); | ||
| 375 | this.groupBox2.ResumeLayout(false); | ||
| 376 | this.panel2.ResumeLayout(false); | ||
| 377 | this.panel2.PerformLayout(); | ||
| 378 | this.ResponseTab.ResumeLayout(false); | ||
| 379 | this.ResponseTabPageTextView.ResumeLayout(false); | ||
| 380 | this.ResponseTabPageTextView.PerformLayout(); | ||
| 381 | this.ResponseTabPageTreeView.ResumeLayout(false); | ||
| 382 | this.tableLayoutPanel1.ResumeLayout(false); | ||
| 383 | this.tableLayoutPanel2.ResumeLayout(false); | ||
| 384 | this.tableLayoutPanel2.PerformLayout(); | ||
| 385 | this.ResumeLayout(false); | ||
| 386 | |||
| 387 | } | ||
| 388 | |||
| 389 | #endregion | ||
| 390 | |||
| 391 | private System.Windows.Forms.SplitContainer splitContainer1; | ||
| 392 | private System.Windows.Forms.GroupBox groupBox1; | ||
| 393 | private System.Windows.Forms.TextBox requestTextBox; | ||
| 394 | private System.Windows.Forms.GroupBox groupBox2; | ||
| 395 | private System.Windows.Forms.TextBox responseTextBox; | ||
| 396 | private System.Windows.Forms.TreeView treeViewResponse; | ||
| 397 | private System.Windows.Forms.TabControl ResponseTab; | ||
| 398 | private System.Windows.Forms.TabPage ResponseTabPageTextView; | ||
| 399 | private System.Windows.Forms.TabPage ResponseTabPageTreeView; | ||
| 400 | private System.Windows.Forms.TabControl RequestTab; | ||
| 401 | private System.Windows.Forms.TabPage RequestTabPageTextView; | ||
| 402 | private System.Windows.Forms.TabPage RequestTabPageTreeView; | ||
| 403 | private System.Windows.Forms.TreeView treeViewRequest; | ||
| 404 | private System.Windows.Forms.CheckBox editRequest; | ||
| 405 | private System.Windows.Forms.LinkLabel updateLinkLabel; | ||
| 406 | private System.Windows.Forms.LinkLabel requestXMLEditor; | ||
| 407 | private System.Windows.Forms.Panel panel1; | ||
| 408 | private System.Windows.Forms.Panel panel2; | ||
| 409 | private System.Windows.Forms.LinkLabel responseXMLEditor; | ||
| 410 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; | ||
| 411 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; | ||
| 412 | private System.Windows.Forms.Button XPathButton; | ||
| 413 | private System.Windows.Forms.TextBox XPathTextBox; | ||
| 414 | private System.Windows.Forms.Label label1; | ||
| 415 | } | ||
| 416 | } |
| 1 | //************************************************************************************************* | ||
| 2 | // WebServiceResult.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // UI of the Web Test Result Tab for Web Service request/response | ||
| 6 | // | ||
| 7 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 8 | //************************************************************************************************* | ||
| 9 | using System; | ||
| 10 | using System.Collections.Generic; | ||
| 11 | using System.ComponentModel; | ||
| 12 | using System.Drawing; | ||
| 13 | using System.Data; | ||
| 14 | using System.Linq; | ||
| 15 | using System.Text; | ||
| 16 | using System.Windows.Forms; | ||
| 17 | using Microsoft.VisualStudio.TestTools.WebTesting; | ||
| 18 | using EnvDTE; | ||
| 19 | using mshtml; | ||
| 20 | using System.IO; | ||
| 21 | using System.Xml; | ||
| 22 | using Microsoft.VisualStudio.TestTools.WebTesting.Rules; | ||
| 23 | using WebTest.WebService.Plugin.Runtime; | ||
| 24 | using System.Xml.XPath; | ||
| 25 | |||
| 26 | namespace WebTest.WebService.Plugin.ResultTab | ||
| 27 | { | ||
| 28 | internal partial class WebServiceResult : UserControl | ||
| 29 | { | ||
| 30 | public WebServiceResult(Connect connect) | ||
| 31 | { | ||
| 32 | this.connect = connect; | ||
| 33 | |||
| 34 | InitializeComponent(); | ||
| 35 | |||
| 36 | this.xmlViewRequest = new XmlTreeView(this.treeViewRequest); | ||
| 37 | this.xmlViewResponse = new XmlTreeView(this.treeViewResponse); | ||
| 38 | this.requestTextBox.TextChanged += new EventHandler(requestTextBox_TextChanged); | ||
| 39 | this.editRequest.CheckedChanged += new EventHandler(EditRequestCheckedChanged); | ||
| 40 | this.treeViewResponse.AfterSelect += new TreeViewEventHandler(treeViewResponse_AfterSelect); | ||
| 41 | |||
| 42 | this.ResponseTab.SelectedTab = this.ResponseTabPageTreeView; | ||
| 43 | this.RequestTab.SelectedTab = this.RequestTabPageTreeView; | ||
| 44 | AddContextMenus(); | ||
| 45 | AddToolTips(); | ||
| 46 | } | ||
| 47 | |||
| 48 | internal WebTestDetail WebTestDetail | ||
| 49 | { | ||
| 50 | get; | ||
| 51 | set; | ||
| 52 | } | ||
| 53 | |||
| 54 | internal void SetWebTestRequestResult(WebTestRequestResult webTestRequestResult, WebTestResultUnit webTestResultUnit) | ||
| 55 | { | ||
| 56 | if (this.xmlViewRequest.MessageEdited) | ||
| 57 | { | ||
| 58 | DialogResult result = MessageBox.Show("You have updated the Request Content. Do you want to save?", "Request Update Pending", MessageBoxButtons.YesNo); | ||
| 59 | |||
| 60 | if (result.Equals(DialogResult.Yes)) | ||
| 61 | { | ||
| 62 | UpdateWebTestForRequest(); | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 66 | ResetUI(); | ||
| 67 | |||
| 68 | this.webTestRequestResult = webTestRequestResult; | ||
| 69 | this.webTestResultUnit = webTestResultUnit; | ||
| 70 | |||
| 71 | ShowRequest(webTestRequestResult.Request); | ||
| 72 | ShowResponse(webTestRequestResult.Response); | ||
| 73 | } | ||
| 74 | |||
| 75 | private void AddContextMenus() | ||
| 76 | { | ||
| 77 | this.responseEditContextMenu = new ContextMenu(); | ||
| 78 | this.requestEditContextMenu = new ContextMenu(); | ||
| 79 | this.responseViewContextMenu = new ContextMenu(); | ||
| 80 | this.requestViewContextMenu = new ContextMenu(); | ||
| 81 | |||
| 82 | this.responseEditContextMenu.MenuItems.Add(new MenuItem("Add Extraction Rule", AddExtractionRule)); | ||
| 83 | this.responseEditContextMenu.MenuItems.Add(new MenuItem("Add Validation Rule", AddValidationRule)); | ||
| 84 | |||
| 85 | MenuItem m = new MenuItem("Parameterize"); | ||
| 86 | m.MenuItems.Add(new MenuItem("Type Parameter", AddParameter)); | ||
| 87 | m.Popup += new EventHandler(ParameterMenuClicked); | ||
| 88 | this.requestEditContextMenu.MenuItems.Add(m); | ||
| 89 | } | ||
| 90 | |||
| 91 | private void AddToolTips() | ||
| 92 | { | ||
| 93 | // Set Tooltips | ||
| 94 | ToolTip toolTip = new ToolTip(); | ||
| 95 | toolTip.SetToolTip(this.editRequest, "Edit the original content of request"); | ||
| 96 | |||
| 97 | toolTip = new ToolTip(); | ||
| 98 | toolTip.SetToolTip(this.requestXMLEditor, "View request contents in XML Editor"); | ||
| 99 | |||
| 100 | toolTip = new ToolTip(); | ||
| 101 | toolTip.SetToolTip(this.responseXMLEditor, "View response contents in XML Editor"); | ||
| 102 | |||
| 103 | toolTip = new ToolTip(); | ||
| 104 | toolTip.SetToolTip(this.updateLinkLabel, "Update the content of original request"); | ||
| 105 | } | ||
| 106 | |||
| 107 | private void EditRequestCheckedChanged(object sender, EventArgs e) | ||
| 108 | { | ||
| 109 | bool editing = false; | ||
| 110 | if (this.webTestResultUnit != null) | ||
| 111 | { | ||
| 112 | if (this.editRequest.Checked) | ||
| 113 | { | ||
| 114 | if (this.WebTestDetail != null) | ||
| 115 | { | ||
| 116 | WebTestRequest requestInWebTest = | ||
| 117 | WebTestDetail.WebTest.GetItem(this.webTestResultUnit.DeclarativeWebTestItemId) | ||
| 118 | as WebTestRequest; | ||
| 119 | |||
| 120 | if (requestInWebTest != null) | ||
| 121 | { | ||
| 122 | ShowRequest(requestInWebTest); | ||
| 123 | editing = true; | ||
| 124 | } | ||
| 125 | } | ||
| 126 | } | ||
| 127 | else | ||
| 128 | { | ||
| 129 | ShowRequest(this.webTestRequestResult.Request); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | if (editing) | ||
| 134 | { | ||
| 135 | this.requestTextBox.ReadOnly = false; | ||
| 136 | this.updateLinkLabel.Visible = true; | ||
| 137 | this.treeViewRequest.LabelEdit = true; | ||
| 138 | this.treeViewRequest.ContextMenu = this.requestEditContextMenu; | ||
| 139 | } | ||
| 140 | else | ||
| 141 | { | ||
| 142 | this.requestTextBox.ReadOnly = true; | ||
| 143 | this.updateLinkLabel.Visible = false; | ||
| 144 | this.treeViewRequest.LabelEdit = false; | ||
| 145 | this.treeViewRequest.ContextMenu = this.requestViewContextMenu; | ||
| 146 | } | ||
| 147 | } | ||
| 148 | |||
| 149 | private void ResetUI() | ||
| 150 | { | ||
| 151 | this.webTestRequestResult = null; | ||
| 152 | this.webTestResultUnit = null; | ||
| 153 | |||
| 154 | this.xPathNavigator = null; | ||
| 155 | this.xPathNamespaces = null; | ||
| 156 | |||
| 157 | this.requestTextBox.Text = string.Empty; | ||
| 158 | this.responseTextBox.Text = string.Empty; | ||
| 159 | this.XPathTextBox.Text = string.Empty; | ||
| 160 | this.responseContentHandler = null; | ||
| 161 | this.requestContentHandler = null; | ||
| 162 | this.treeViewRequest.Nodes.Clear(); | ||
| 163 | this.treeViewResponse.Nodes.Clear(); | ||
| 164 | this.editRequest.Checked = false; | ||
| 165 | this.updateLinkLabel.Visible = false; | ||
| 166 | |||
| 167 | this.requestTreePopulated = false; | ||
| 168 | this.xmlViewRequest.MessageEdited = false; | ||
| 169 | } | ||
| 170 | |||
| 171 | private void ShowResponse(WebTestResponse webTestResponse) | ||
| 172 | { | ||
| 173 | if (webTestResponse != null && webTestResponse.BodyBytes != null) | ||
| 174 | { | ||
| 175 | responseContentHandler = ContentHandlerFactory.GetHandler(webTestResponse.ContentType); | ||
| 176 | if (responseContentHandler != null) | ||
| 177 | { | ||
| 178 | if (responseContentHandler.IsBinary) | ||
| 179 | { | ||
| 180 | responseContentHandler.MessageBytes = webTestResponse.BodyBytes; | ||
| 181 | } | ||
| 182 | else | ||
| 183 | { | ||
| 184 | responseContentHandler.MessageString = webTestResponse.BodyString; | ||
| 185 | } | ||
| 186 | |||
| 187 | this.responseTextBox.Text = responseContentHandler.XmlString; | ||
| 188 | this.xmlViewResponse.ShowXML(responseContentHandler.XmlDocument); | ||
| 189 | } | ||
| 190 | } | ||
| 191 | |||
| 192 | if (this.treeViewResponse.Nodes.Count > 0) | ||
| 193 | { | ||
| 194 | if (webTestResultUnit == null || WebTestDetail == null) | ||
| 195 | { | ||
| 196 | this.treeViewResponse.ContextMenu = this.responseViewContextMenu; | ||
| 197 | } | ||
| 198 | else | ||
| 199 | { | ||
| 200 | this.treeViewResponse.ContextMenu = this.responseEditContextMenu; | ||
| 201 | } | ||
| 202 | } | ||
| 203 | else | ||
| 204 | { | ||
| 205 | this.treeViewResponse.ContextMenu = null; | ||
| 206 | } | ||
| 207 | |||
| 208 | if (string.IsNullOrEmpty(this.responseTextBox.Text)) | ||
| 209 | { | ||
| 210 | this.responseXMLEditor.Visible = false; | ||
| 211 | } | ||
| 212 | else | ||
| 213 | { | ||
| 214 | this.responseXMLEditor.Visible = true; | ||
| 215 | } | ||
| 216 | } | ||
| 217 | |||
| 218 | private void ShowRequest(WebTestRequest webTestRequest) | ||
| 219 | { | ||
| 220 | this.requestContentHandler = null; | ||
| 221 | if (webTestRequest != null && webTestRequest.Body != null) | ||
| 222 | { | ||
| 223 | BinaryHttpBody binaryHttpBody = webTestRequest.Body as BinaryHttpBody; | ||
| 224 | if (binaryHttpBody != null) | ||
| 225 | { | ||
| 226 | this.requestContentHandler = ContentHandlerFactory.GetHandler(binaryHttpBody.ContentType); | ||
| 227 | if (this.requestContentHandler != null) | ||
| 228 | { | ||
| 229 | this.requestContentHandler.MessageBytes = binaryHttpBody.Data; | ||
| 230 | } | ||
| 231 | } | ||
| 232 | |||
| 233 | StringHttpBody stringHttpBody = webTestRequest.Body as StringHttpBody; | ||
| 234 | if (stringHttpBody != null) | ||
| 235 | { | ||
| 236 | this.requestContentHandler = ContentHandlerFactory.GetHandler(stringHttpBody.ContentType); | ||
| 237 | if (this.requestContentHandler != null) | ||
| 238 | { | ||
| 239 | this.requestContentHandler.MessageString = stringHttpBody.BodyString; | ||
| 240 | } | ||
| 241 | } | ||
| 242 | |||
| 243 | if (this.requestContentHandler != null) | ||
| 244 | { | ||
| 245 | this.requestTextBox.Text = this.requestContentHandler.XmlString; | ||
| 246 | xmlViewRequest.ShowXML(this.requestContentHandler.XmlDocument); | ||
| 247 | this.requestTreePopulated = true; | ||
| 248 | } | ||
| 249 | } | ||
| 250 | |||
| 251 | this.xmlViewRequest.MessageEdited = false; | ||
| 252 | |||
| 253 | if (string.IsNullOrEmpty(this.requestTextBox.Text)) | ||
| 254 | { | ||
| 255 | this.requestXMLEditor.Visible = false; | ||
| 256 | this.editRequest.Visible = false; | ||
| 257 | } | ||
| 258 | else | ||
| 259 | { | ||
| 260 | this.requestXMLEditor.Visible = true; | ||
| 261 | this.editRequest.Visible = (this.WebTestDetail != null); | ||
| 262 | } | ||
| 263 | } | ||
| 264 | |||
| 265 | private void ParameterMenuClicked(object sender, EventArgs e) | ||
| 266 | { | ||
| 267 | MenuItem menuItem = sender as MenuItem; | ||
| 268 | |||
| 269 | if (menuItem != null) | ||
| 270 | { | ||
| 271 | DeclarativeWebTest webTest = WebTestDetail.WebTest; | ||
| 272 | menuItem.MenuItems.Clear(); | ||
| 273 | |||
| 274 | menuItem.MenuItems.Add(new MenuItem("Type Parameter", AddParameter)); | ||
| 275 | for (int i = 1; i < this.webTestResultUnit.DeclarativeWebTestItemId; i++) | ||
| 276 | { | ||
| 277 | WebTestRequest requestInWebTest = webTest.GetItem(i) as WebTestRequest; | ||
| 278 | if (requestInWebTest != null) | ||
| 279 | { | ||
| 280 | foreach (ExtractionRuleReference reference in requestInWebTest.ExtractionRuleReferences) | ||
| 281 | { | ||
| 282 | menuItem.MenuItems.Add(new MenuItem(reference.ContextParameterName, AddParameter)); | ||
| 283 | } | ||
| 284 | } | ||
| 285 | } | ||
| 286 | } | ||
| 287 | } | ||
| 288 | |||
| 289 | private void AddParameter(object sender, EventArgs e) | ||
| 290 | { | ||
| 291 | MenuItem menuItem = sender as MenuItem; | ||
| 292 | if (menuItem == null) | ||
| 293 | { | ||
| 294 | return; | ||
| 295 | } | ||
| 296 | this.xmlViewRequest.AddParameter(menuItem.Text); | ||
| 297 | } | ||
| 298 | |||
| 299 | private void requestTextBox_TextChanged(object sender, EventArgs e) | ||
| 300 | { | ||
| 301 | this.xmlViewRequest.MessageEdited = true; | ||
| 302 | } | ||
| 303 | |||
| 304 | /// <summary> | ||
| 305 | /// 1. Enable Extraction Rule if known Web Test | ||
| 306 | /// 2. Before adding extraction rule, check if there is an open unsaved document | ||
| 307 | /// 3. Prompt user to save if unsaved, and save it | ||
| 308 | /// 4. Parse Declarative Web Test from file, and add extraction rule | ||
| 309 | /// 5. Open the document again, if it was open previously | ||
| 310 | /// 6. Using TimeStamp,determine if Declarative Web Test at hand is uptodate. | ||
| 311 | /// </summary> | ||
| 312 | /// <param name="sender"></param> | ||
| 313 | /// <param name="e"></param> | ||
| 314 | private void AddExtractionRule(object sender, EventArgs e) | ||
| 315 | { | ||
| 316 | if (string.IsNullOrEmpty(this.XPathTextBox.Text)) | ||
| 317 | { | ||
| 318 | return; | ||
| 319 | } | ||
| 320 | |||
| 321 | if (WebTestDetail != null) | ||
| 322 | { | ||
| 323 | // If there are pending changes, save first, as we are going to make our | ||
| 324 | // changes to the file directly. | ||
| 325 | WebTestDetail.PrepareToSave(); | ||
| 326 | |||
| 327 | WebTestRequest requestInWebTest = WebTestDetail.WebTest.GetItem(this.webTestResultUnit.DeclarativeWebTestItemId) as WebTestRequest; | ||
| 328 | |||
| 329 | if (requestInWebTest != null) | ||
| 330 | { | ||
| 331 | string contextParamName = "xpathParam"; | ||
| 332 | TreeNode selectedNode = this.treeViewResponse.SelectedNode; | ||
| 333 | if (selectedNode != null) | ||
| 334 | { | ||
| 335 | if (selectedNode.Nodes.Count > 0) | ||
| 336 | { | ||
| 337 | contextParamName = selectedNode.Text; | ||
| 338 | } | ||
| 339 | else if (selectedNode.Parent != null) | ||
| 340 | { | ||
| 341 | contextParamName = selectedNode.Parent.Text; | ||
| 342 | } | ||
| 343 | } | ||
| 344 | |||
| 345 | ExtractionRuleReference extractTextReference = new ExtractionRuleReference(); | ||
| 346 | extractTextReference.Type = typeof(XPathExtractionRule); | ||
| 347 | extractTextReference.ContextParameterName = contextParamName; | ||
| 348 | extractTextReference.Properties.Add(new PluginOrRuleProperty("XPathToSearch", this.XPathTextBox.Text)); | ||
| 349 | extractTextReference.Properties.Add(new PluginOrRuleProperty("Index", "0")); | ||
| 350 | extractTextReference.Properties.Add(new PluginOrRuleProperty("ExtractRandomMatch", "False")); | ||
| 351 | |||
| 352 | requestInWebTest.ExtractionRuleReferences.Add(extractTextReference); | ||
| 353 | |||
| 354 | WebTestDetail.Save(); | ||
| 355 | |||
| 356 | string message = string.Format( | ||
| 357 | @"The extraction rule was created, and the text is extracted to a context parameter named '{0}'. You will need to add bindings to this context parameter in the appropriate places in the script. | ||
| 358 | |||
| 359 | XPath to Evaluate: ‘{1}’ | ||
| 360 | |||
| 361 | The extraction rule was created under the following request: | ||
| 362 | ‘{2}’", contextParamName, this.XPathTextBox.Text, requestInWebTest.Url); | ||
| 363 | |||
| 364 | MessageBox.Show(message, "Extraction Rule Created"); | ||
| 365 | } | ||
| 366 | } | ||
| 367 | } | ||
| 368 | |||
| 369 | private void AddValidationRule(object sender, EventArgs e) | ||
| 370 | { | ||
| 371 | if (string.IsNullOrEmpty(this.XPathTextBox.Text)) | ||
| 372 | { | ||
| 373 | return; | ||
| 374 | } | ||
| 375 | |||
| 376 | if (WebTestDetail != null) | ||
| 377 | { | ||
| 378 | TreeNode treeNode = this.treeViewResponse.SelectedNode; | ||
| 379 | TreeNode parentNode = treeNode.Parent; | ||
| 380 | |||
| 381 | if (parentNode == null) | ||
| 382 | { | ||
| 383 | return; | ||
| 384 | } | ||
| 385 | |||
| 386 | // If there are pending changes, save first, as we are going to make our | ||
| 387 | // changes to the file directly. | ||
| 388 | WebTestDetail.PrepareToSave(); | ||
| 389 | |||
| 390 | WebTestRequest requestInWebTest = WebTestDetail.WebTest.GetItem(this.webTestResultUnit.DeclarativeWebTestItemId) as WebTestRequest; | ||
| 391 | |||
| 392 | if (requestInWebTest != null) | ||
| 393 | { | ||
| 394 | string expectedValue = string.Empty; | ||
| 395 | SetupResponseXpath(); | ||
| 396 | |||
| 397 | // Compile a standard XPath expression | ||
| 398 | XPathExpression expr; | ||
| 399 | expr = this.xPathNavigator.Compile(this.XPathTextBox.Text); | ||
| 400 | expr.SetContext(xPathNamespaces); | ||
| 401 | XPathNodeIterator iterator = this.xPathNavigator.Select(expr); | ||
| 402 | |||
| 403 | if (iterator.MoveNext()) | ||
| 404 | { | ||
| 405 | XPathNavigator nav2 = iterator.Current.Clone(); | ||
| 406 | expectedValue = nav2.InnerXml; | ||
| 407 | } | ||
| 408 | |||
| 409 | ValidationRuleReference validationTextReference = new ValidationRuleReference(); | ||
| 410 | validationTextReference.Type = typeof(XPathValidationRule); | ||
| 411 | validationTextReference.Properties.Add(new PluginOrRuleProperty("XPathToSearch", this.XPathTextBox.Text)); | ||
| 412 | validationTextReference.Properties.Add(new PluginOrRuleProperty("Index", "0")); | ||
| 413 | validationTextReference.Properties.Add(new PluginOrRuleProperty("IgnoreCase", "True")); | ||
| 414 | validationTextReference.Properties.Add(new PluginOrRuleProperty("ExpectedValue", expectedValue)); | ||
| 415 | |||
| 416 | requestInWebTest.ValidationRuleReferences.Add(validationTextReference); | ||
| 417 | |||
| 418 | WebTestDetail.Save(); | ||
| 419 | |||
| 420 | string message = string.Format( | ||
| 421 | @"The validation rule was created. | ||
| 422 | |||
| 423 | XPath to Evaluate: ‘{0}’ | ||
| 424 | Expected Value: '{1}' | ||
| 425 | |||
| 426 | The extraction rule was created under the following request: | ||
| 427 | ‘{2}’", this.XPathTextBox.Text, expectedValue, requestInWebTest.Url); | ||
| 428 | |||
| 429 | MessageBox.Show(message, "Validation Rule Created"); | ||
| 430 | } | ||
| 431 | } | ||
| 432 | } | ||
| 433 | |||
| 434 | private void ResponseTabChanged(object sender, EventArgs e) | ||
| 435 | { | ||
| 436 | } | ||
| 437 | |||
| 438 | private void RequestTabChanged(object sender, EventArgs e) | ||
| 439 | { | ||
| 440 | if (requestTreePopulated && (!this.editRequest.Checked)) | ||
| 441 | { | ||
| 442 | return; | ||
| 443 | } | ||
| 444 | |||
| 445 | if (string.IsNullOrEmpty(this.requestTextBox.Text)) | ||
| 446 | { | ||
| 447 | return; | ||
| 448 | } | ||
| 449 | |||
| 450 | if (this.RequestTab.SelectedTab.Equals(this.RequestTabPageTreeView)) | ||
| 451 | { | ||
| 452 | if (this.requestContentHandler != null) | ||
| 453 | { | ||
| 454 | this.requestContentHandler.XmlString = this.requestTextBox.Text; | ||
| 455 | this.xmlViewRequest.ShowXML(this.requestContentHandler.XmlDocument); | ||
| 456 | } | ||
| 457 | } | ||
| 458 | else | ||
| 459 | { | ||
| 460 | if (this.requestContentHandler != null) | ||
| 461 | { | ||
| 462 | this.requestTextBox.Text = this.requestContentHandler.XmlString; | ||
| 463 | } | ||
| 464 | } | ||
| 465 | this.requestTreePopulated = true; | ||
| 466 | } | ||
| 467 | |||
| 468 | private void requestXMLEditor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) | ||
| 469 | { | ||
| 470 | if (this.requestContentHandler != null) | ||
| 471 | { | ||
| 472 | string message = string.Empty; | ||
| 473 | if (!this.RequestTab.SelectedTab.Equals(this.RequestTabPageTreeView)) | ||
| 474 | { | ||
| 475 | this.requestContentHandler.XmlString = this.requestTextBox.Text; | ||
| 476 | } | ||
| 477 | |||
| 478 | this.connect.ShowInXMLEditor(this.webTestRequestResult.Request.Url + " [Request]", | ||
| 479 | this.requestContentHandler.XmlString); | ||
| 480 | } | ||
| 481 | } | ||
| 482 | |||
| 483 | private void responseXMLEditor_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) | ||
| 484 | { | ||
| 485 | if (this.responseContentHandler != null) | ||
| 486 | { | ||
| 487 | this.connect.ShowInXMLEditor(this.webTestRequestResult.Request.Url + " [Response]", this.responseTextBox.Text); | ||
| 488 | } | ||
| 489 | } | ||
| 490 | |||
| 491 | private void updateLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) | ||
| 492 | { | ||
| 493 | UpdateWebTestForRequest(); | ||
| 494 | } | ||
| 495 | |||
| 496 | private void UpdateWebTestForRequest() | ||
| 497 | { | ||
| 498 | if (WebTestDetail != null && this.requestContentHandler != null) | ||
| 499 | { | ||
| 500 | // If there are pending changes, save first, as we are going to make our | ||
| 501 | // changes to the file directly. | ||
| 502 | WebTestDetail.PrepareToSave(); | ||
| 503 | |||
| 504 | // Get the original request | ||
| 505 | WebTestRequest requestInWebTest = | ||
| 506 | WebTestDetail.WebTest.GetItem(this.webTestResultUnit.DeclarativeWebTestItemId) | ||
| 507 | as WebTestRequest; | ||
| 508 | if (requestInWebTest == null) | ||
| 509 | { | ||
| 510 | // error | ||
| 511 | return; | ||
| 512 | } | ||
| 513 | |||
| 514 | // Update content if edited in text box | ||
| 515 | if (!this.RequestTab.SelectedTab.Equals(this.RequestTabPageTreeView)) | ||
| 516 | { | ||
| 517 | this.requestContentHandler.XmlString = this.requestTextBox.Text; | ||
| 518 | } | ||
| 519 | |||
| 520 | // Fill the request body with updated content | ||
| 521 | if (this.requestContentHandler.IsBinary) | ||
| 522 | { | ||
| 523 | BinaryHttpBody binaryHttpBody = requestInWebTest.Body as BinaryHttpBody; | ||
| 524 | if (binaryHttpBody != null) | ||
| 525 | { | ||
| 526 | // set the new binary data into http body | ||
| 527 | binaryHttpBody.Data = this.requestContentHandler.MessageBytes; | ||
| 528 | return; | ||
| 529 | } | ||
| 530 | } | ||
| 531 | else | ||
| 532 | { | ||
| 533 | StringHttpBody stringHttpBody = requestInWebTest.Body as StringHttpBody; | ||
| 534 | if (stringHttpBody != null) | ||
| 535 | { | ||
| 536 | stringHttpBody.BodyString = this.requestContentHandler.MessageString; | ||
| 537 | } | ||
| 538 | } | ||
| 539 | |||
| 540 | // Save WebTest | ||
| 541 | WebTestDetail.Save(); | ||
| 542 | this.xmlViewRequest.MessageEdited = false; | ||
| 543 | } | ||
| 544 | } | ||
| 545 | |||
| 546 | #region XPathResponse | ||
| 547 | private void treeViewResponse_AfterSelect(object sender, TreeViewEventArgs e) | ||
| 548 | { | ||
| 549 | TreeNode selectedNode = this.treeViewResponse.SelectedNode; | ||
| 550 | if (selectedNode == null) | ||
| 551 | { | ||
| 552 | return; | ||
| 553 | } | ||
| 554 | |||
| 555 | |||
| 556 | TreeNode parentNode = selectedNode.Parent; | ||
| 557 | if (parentNode == null) | ||
| 558 | { | ||
| 559 | this.XPathTextBox.Text = "/" + GetXPathSubExpression(selectedNode.Text); | ||
| 560 | return; | ||
| 561 | } | ||
| 562 | |||
| 563 | if (selectedNode.Nodes.Count == 0) | ||
| 564 | { | ||
| 565 | selectedNode = parentNode; | ||
| 566 | parentNode = parentNode.Parent; | ||
| 567 | } | ||
| 568 | |||
| 569 | string xPath = string.Empty; | ||
| 570 | |||
| 571 | bool addedDoubleSlashes = false; | ||
| 572 | while (parentNode != null) | ||
| 573 | { | ||
| 574 | int index = 1; | ||
| 575 | if (parentNode.Nodes.Count > 1) | ||
| 576 | { | ||
| 577 | for (int i = 0; i < selectedNode.Index; i++) | ||
| 578 | { | ||
| 579 | if (parentNode.Nodes[i].Text.Equals(selectedNode.Text)) | ||
| 580 | { | ||
| 581 | index++; | ||
| 582 | } | ||
| 583 | } | ||
| 584 | |||
| 585 | string xpathExpression = GetXPathSubExpression(selectedNode.Text); | ||
| 586 | |||
| 587 | if (index > 1) | ||
| 588 | { | ||
| 589 | xPath = "/" + xpathExpression + "[" + index + "]" + xPath; | ||
| 590 | } | ||
| 591 | else | ||
| 592 | { | ||
| 593 | xPath = "/" + xpathExpression + xPath; | ||
| 594 | } | ||
| 595 | |||
| 596 | addedDoubleSlashes = false; | ||
| 597 | } | ||
| 598 | else | ||
| 599 | { | ||
| 600 | if (string.IsNullOrEmpty(xPath)) | ||
| 601 | { | ||
| 602 | xPath = "/" + GetXPathSubExpression(selectedNode.Text); | ||
| 603 | } | ||
| 604 | else if (!addedDoubleSlashes) | ||
| 605 | { | ||
| 606 | // Ignore intermediate single elements to reduce XPath length | ||
| 607 | xPath = "/" + xPath; | ||
| 608 | addedDoubleSlashes = true; | ||
| 609 | } | ||
| 610 | } | ||
| 611 | |||
| 612 | selectedNode = parentNode; | ||
| 613 | parentNode = parentNode.Parent; | ||
| 614 | } | ||
| 615 | |||
| 616 | if (!addedDoubleSlashes) | ||
| 617 | { | ||
| 618 | xPath = "/" + xPath; | ||
| 619 | } | ||
| 620 | this.XPathTextBox.Text = xPath; | ||
| 621 | } | ||
| 622 | |||
| 623 | private string GetXPathSubExpression(string name) | ||
| 624 | { | ||
| 625 | if (name.Contains(':')) | ||
| 626 | { | ||
| 627 | return name; | ||
| 628 | } | ||
| 629 | else | ||
| 630 | { | ||
| 631 | return string.Format("*[local-name()='{0}']", name); | ||
| 632 | } | ||
| 633 | } | ||
| 634 | |||
| 635 | private void XPathButton_Click(object sender, EventArgs e) | ||
| 636 | { | ||
| 637 | try | ||
| 638 | { | ||
| 639 | SetupResponseXpath(); | ||
| 640 | |||
| 641 | // Compile a standard XPath expression | ||
| 642 | XPathExpression expr; | ||
| 643 | expr = this.xPathNavigator.Compile(this.XPathTextBox.Text); | ||
| 644 | expr.SetContext(xPathNamespaces); | ||
| 645 | XPathNodeIterator iterator = this.xPathNavigator.Select(expr); | ||
| 646 | |||
| 647 | int i = 1; | ||
| 648 | while (iterator.MoveNext()) | ||
| 649 | { | ||
| 650 | XPathNavigator nav2 = iterator.Current.Clone(); | ||
| 651 | string value = string.Empty; | ||
| 652 | if (nav2.NodeType.Equals(XPathNodeType.Element)) | ||
| 653 | { | ||
| 654 | value = nav2.InnerXml; | ||
| 655 | } | ||
| 656 | else | ||
| 657 | { | ||
| 658 | value = nav2.Value; | ||
| 659 | } | ||
| 660 | |||
| 661 | if (i < iterator.Count) | ||
| 662 | { | ||
| 663 | string displayText = string.Format("Result[{0} of {1}]:{2}{3}{4}{5}{6}Do you want to display next?", | ||
| 664 | i, | ||
| 665 | iterator.Count, | ||
| 666 | Environment.NewLine, | ||
| 667 | Environment.NewLine, | ||
| 668 | value, | ||
| 669 | Environment.NewLine, | ||
| 670 | Environment.NewLine); | ||
| 671 | DialogResult result = MessageBox.Show(displayText, "XPath Result", MessageBoxButtons.YesNoCancel); | ||
| 672 | if (!result.Equals(DialogResult.Yes)) | ||
| 673 | { | ||
| 674 | return; | ||
| 675 | } | ||
| 676 | } | ||
| 677 | else | ||
| 678 | { | ||
| 679 | string displayText = string.Format("Result[{0} of {1}]:{2}{3}{4}", | ||
| 680 | i, | ||
| 681 | iterator.Count, | ||
| 682 | Environment.NewLine, | ||
| 683 | Environment.NewLine, | ||
| 684 | value); | ||
| 685 | MessageBox.Show(displayText, "XPath Result"); | ||
| 686 | |||
| 687 | return; | ||
| 688 | } | ||
| 689 | i++; | ||
| 690 | } | ||
| 691 | |||
| 692 | MessageBox.Show("No Results to Display", "XPath Result"); | ||
| 693 | } | ||
| 694 | catch (Exception ex) | ||
| 695 | { | ||
| 696 | MessageBox.Show(ex.Message, "XPath Result"); | ||
| 697 | } | ||
| 698 | } | ||
| 699 | |||
| 700 | private void SetupResponseXpath() | ||
| 701 | { | ||
| 702 | if (xPathNavigator == null && this.responseContentHandler != null) | ||
| 703 | { | ||
| 704 | |||
| 705 | this.xPathNavigator = new XPathDocument( | ||
| 706 | new StringReader(this.responseContentHandler.XmlString) | ||
| 707 | ).CreateNavigator(); | ||
| 708 | |||
| 709 | this.xPathNamespaces = new XmlNamespaceManager(this.xPathNavigator.NameTable); | ||
| 710 | while (this.xPathNavigator.MoveToFollowing(XPathNodeType.Element)) | ||
| 711 | { | ||
| 712 | IDictionary<string, string> whatever = this.xPathNavigator.GetNamespacesInScope(XmlNamespaceScope.All); | ||
| 713 | foreach (KeyValuePair<string, string> key in whatever) | ||
| 714 | { | ||
| 715 | this.xPathNamespaces.AddNamespace(key.Key, key.Value); | ||
| 716 | } | ||
| 717 | } | ||
| 718 | } | ||
| 719 | } | ||
| 720 | |||
| 721 | #endregion | ||
| 722 | |||
| 723 | private WebTestRequestResult webTestRequestResult; | ||
| 724 | private WebTestResultUnit webTestResultUnit; | ||
| 725 | private ContextMenu responseEditContextMenu; | ||
| 726 | private ContextMenu requestEditContextMenu; | ||
| 727 | |||
| 728 | private XmlTreeView xmlViewRequest; | ||
| 729 | private XmlTreeView xmlViewResponse; | ||
| 730 | |||
| 731 | private ContextMenu responseViewContextMenu; | ||
| 732 | private ContextMenu requestViewContextMenu; | ||
| 733 | |||
| 734 | private bool requestTreePopulated = false; | ||
| 735 | |||
| 736 | private XPathNavigator xPathNavigator = null; | ||
| 737 | private XmlNamespaceManager xPathNamespaces = null; | ||
| 738 | |||
| 739 | private ContentHandler responseContentHandler; | ||
| 740 | private ContentHandler requestContentHandler; | ||
| 741 | private Connect connect; | ||
| 742 | } | ||
| 743 | } |
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <root> | ||
| 3 | <!-- | ||
| 4 | Microsoft ResX Schema | ||
| 5 | |||
| 6 | Version 2.0 | ||
| 7 | |||
| 8 | The primary goals of this format is to allow a simple XML format | ||
| 9 | that is mostly human readable. The generation and parsing of the | ||
| 10 | various data types are done through the TypeConverter classes | ||
| 11 | associated with the data types. | ||
| 12 | |||
| 13 | Example: | ||
| 14 | |||
| 15 | ... ado.net/XML headers & schema ... | ||
| 16 | <resheader name="resmimetype">text/microsoft-resx</resheader> | ||
| 17 | <resheader name="version">2.0</resheader> | ||
| 18 | <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||
| 19 | <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||
| 20 | <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||
| 21 | <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||
| 22 | <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||
| 23 | <value>[base64 mime encoded serialized .NET Framework object]</value> | ||
| 24 | </data> | ||
| 25 | <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
| 26 | <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||
| 27 | <comment>This is a comment</comment> | ||
| 28 | </data> | ||
| 29 | |||
| 30 | There are any number of "resheader" rows that contain simple | ||
| 31 | name/value pairs. | ||
| 32 | |||
| 33 | Each data row contains a name, and value. The row also contains a | ||
| 34 | type or mimetype. Type corresponds to a .NET class that support | ||
| 35 | text/value conversion through the TypeConverter architecture. | ||
| 36 | Classes that don't support this are serialized and stored with the | ||
| 37 | mimetype set. | ||
| 38 | |||
| 39 | The mimetype is used for serialized objects, and tells the | ||
| 40 | ResXResourceReader how to depersist the object. This is currently not | ||
| 41 | extensible. For a given mimetype the value must be set accordingly: | ||
| 42 | |||
| 43 | Note - application/x-microsoft.net.object.binary.base64 is the format | ||
| 44 | that the ResXResourceWriter will generate, however the reader can | ||
| 45 | read any of the formats listed below. | ||
| 46 | |||
| 47 | mimetype: application/x-microsoft.net.object.binary.base64 | ||
| 48 | value : The object must be serialized with | ||
| 49 | : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||
| 50 | : and then encoded with base64 encoding. | ||
| 51 | |||
| 52 | mimetype: application/x-microsoft.net.object.soap.base64 | ||
| 53 | value : The object must be serialized with | ||
| 54 | : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||
| 55 | : and then encoded with base64 encoding. | ||
| 56 | |||
| 57 | mimetype: application/x-microsoft.net.object.bytearray.base64 | ||
| 58 | value : The object must be serialized into a byte array | ||
| 59 | : using a System.ComponentModel.TypeConverter | ||
| 60 | : and then encoded with base64 encoding. | ||
| 61 | --> | ||
| 62 | <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
| 63 | <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||
| 64 | <xsd:element name="root" msdata:IsDataSet="true"> | ||
| 65 | <xsd:complexType> | ||
| 66 | <xsd:choice maxOccurs="unbounded"> | ||
| 67 | <xsd:element name="metadata"> | ||
| 68 | <xsd:complexType> | ||
| 69 | <xsd:sequence> | ||
| 70 | <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
| 71 | </xsd:sequence> | ||
| 72 | <xsd:attribute name="name" use="required" type="xsd:string" /> | ||
| 73 | <xsd:attribute name="type" type="xsd:string" /> | ||
| 74 | <xsd:attribute name="mimetype" type="xsd:string" /> | ||
| 75 | <xsd:attribute ref="xml:space" /> | ||
| 76 | </xsd:complexType> | ||
| 77 | </xsd:element> | ||
| 78 | <xsd:element name="assembly"> | ||
| 79 | <xsd:complexType> | ||
| 80 | <xsd:attribute name="alias" type="xsd:string" /> | ||
| 81 | <xsd:attribute name="name" type="xsd:string" /> | ||
| 82 | </xsd:complexType> | ||
| 83 | </xsd:element> | ||
| 84 | <xsd:element name="data"> | ||
| 85 | <xsd:complexType> | ||
| 86 | <xsd:sequence> | ||
| 87 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
| 88 | <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
| 89 | </xsd:sequence> | ||
| 90 | <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||
| 91 | <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
| 92 | <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
| 93 | <xsd:attribute ref="xml:space" /> | ||
| 94 | </xsd:complexType> | ||
| 95 | </xsd:element> | ||
| 96 | <xsd:element name="resheader"> | ||
| 97 | <xsd:complexType> | ||
| 98 | <xsd:sequence> | ||
| 99 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
| 100 | </xsd:sequence> | ||
| 101 | <xsd:attribute name="name" type="xsd:string" use="required" /> | ||
| 102 | </xsd:complexType> | ||
| 103 | </xsd:element> | ||
| 104 | </xsd:choice> | ||
| 105 | </xsd:complexType> | ||
| 106 | </xsd:element> | ||
| 107 | </xsd:schema> | ||
| 108 | <resheader name="resmimetype"> | ||
| 109 | <value>text/microsoft-resx</value> | ||
| 110 | </resheader> | ||
| 111 | <resheader name="version"> | ||
| 112 | <value>2.0</value> | ||
| 113 | </resheader> | ||
| 114 | <resheader name="reader"> | ||
| 115 | <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
| 116 | </resheader> | ||
| 117 | <resheader name="writer"> | ||
| 118 | <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
| 119 | </resheader> | ||
| 120 | </root> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | //************************************************************************************************* | ||
| 2 | // WebTestDetail.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // Details of WebTest | ||
| 6 | // | ||
| 7 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 8 | //************************************************************************************************* | ||
| 9 | using System; | ||
| 10 | using System.IO; | ||
| 11 | using System.Collections.Generic; | ||
| 12 | using System.Linq; | ||
| 13 | using System.Text; | ||
| 14 | using EnvDTE80; | ||
| 15 | using EnvDTE; | ||
| 16 | using Microsoft.VisualStudio.TestTools.WebTesting; | ||
| 17 | |||
| 18 | namespace WebTest.WebService.Plugin.ResultTab | ||
| 19 | { | ||
| 20 | /// <summary> | ||
| 21 | /// Details of a Declarative WebTest project Item | ||
| 22 | /// </summary> | ||
| 23 | public class WebTestDetail | ||
| 24 | { | ||
| 25 | /// <summary> | ||
| 26 | /// | ||
| 27 | /// </summary> | ||
| 28 | /// <param name="fullPath"></param> | ||
| 29 | /// <param name="applicationObject"></param> | ||
| 30 | public WebTestDetail(string fullPath, DTE2 applicationObject) | ||
| 31 | { | ||
| 32 | this.FullPath = fullPath; | ||
| 33 | this._applicationObject = applicationObject; | ||
| 34 | } | ||
| 35 | |||
| 36 | /// <summary> | ||
| 37 | /// Web Test object | ||
| 38 | /// </summary> | ||
| 39 | public DeclarativeWebTest WebTest | ||
| 40 | { | ||
| 41 | get | ||
| 42 | { | ||
| 43 | if (webTest == null || (new FileInfo(FullPath).LastWriteTime > LastSavedTimeStamp)) | ||
| 44 | { | ||
| 45 | webTest = DeclarativeWebTestSerializer.Open(FullPath); | ||
| 46 | LastSavedTimeStamp = new FileInfo(FullPath).LastWriteTime; | ||
| 47 | } | ||
| 48 | return webTest; | ||
| 49 | } | ||
| 50 | set | ||
| 51 | { | ||
| 52 | webTest = value; | ||
| 53 | LastSavedTimeStamp = new FileInfo(FullPath).LastWriteTime; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | /// <summary> | ||
| 58 | /// Path to the WebTest file | ||
| 59 | /// </summary> | ||
| 60 | public string FullPath | ||
| 61 | { | ||
| 62 | get; | ||
| 63 | set; | ||
| 64 | } | ||
| 65 | |||
| 66 | /// <summary> | ||
| 67 | /// LastSavedTimeStamp | ||
| 68 | /// </summary> | ||
| 69 | public DateTime LastSavedTimeStamp | ||
| 70 | { | ||
| 71 | get; | ||
| 72 | set; | ||
| 73 | } | ||
| 74 | |||
| 75 | /// <summary> | ||
| 76 | /// ProjectItem of DTE | ||
| 77 | /// </summary> | ||
| 78 | public ProjectItem ProjectItem | ||
| 79 | { | ||
| 80 | get; | ||
| 81 | set; | ||
| 82 | } | ||
| 83 | |||
| 84 | /// <summary> | ||
| 85 | /// If there are pending changes, save first, as we are going to make our | ||
| 86 | /// changes to the file directly. | ||
| 87 | /// </summary> | ||
| 88 | public void PrepareToSave() | ||
| 89 | { | ||
| 90 | if (this.ProjectItem != null && this.ProjectItem.Document != null) | ||
| 91 | { | ||
| 92 | this.ProjectItem.Document.Close(vsSaveChanges.vsSaveChangesPrompt); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | /// <summary> | ||
| 97 | /// Save WebTest to file | ||
| 98 | /// </summary> | ||
| 99 | public void Save() | ||
| 100 | { | ||
| 101 | DeclarativeWebTestSerializer.Save(this.WebTest, this.FullPath); | ||
| 102 | this.LastSavedTimeStamp = DateTime.Now; | ||
| 103 | |||
| 104 | if (this.ProjectItem != null) | ||
| 105 | { | ||
| 106 | Window window = this.ProjectItem.Open(); | ||
| 107 | window.Activate(); | ||
| 108 | } | ||
| 109 | } | ||
| 110 | |||
| 111 | /// <summary> | ||
| 112 | /// Parse parameters from all items of Web Test | ||
| 113 | /// </summary> | ||
| 114 | /// <returns></returns> | ||
| 115 | public List<string> GetParameterList() | ||
| 116 | { | ||
| 117 | List<string> list = new List<string>(); | ||
| 118 | |||
| 119 | DeclarativeWebTest w = WebTest; | ||
| 120 | |||
| 121 | for (int i = 1; i <= w.Items.Count; i++) | ||
| 122 | { | ||
| 123 | WebTestRequest requestInWebTest = webTest.GetItem(i) as WebTestRequest; | ||
| 124 | if (requestInWebTest != null) | ||
| 125 | { | ||
| 126 | foreach (ExtractionRuleReference reference in requestInWebTest.ExtractionRuleReferences) | ||
| 127 | { | ||
| 128 | list.Add(reference.ContextParameterName); | ||
| 129 | } | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | return list; | ||
| 134 | } | ||
| 135 | |||
| 136 | private DTE2 _applicationObject; | ||
| 137 | private DeclarativeWebTest webTest = null; | ||
| 138 | } | ||
| 139 | } |
WebTestWebServiceResultAddin/XmlTreeView.cs
0 → 100644
| 1 | //************************************************************************************************* | ||
| 2 | // XmlTreeView.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // Wrapper for TreeView that bings XML to TreeView | ||
| 6 | // | ||
| 7 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 8 | //************************************************************************************************* | ||
| 9 | using System; | ||
| 10 | using System.Collections.Generic; | ||
| 11 | using System.Linq; | ||
| 12 | using System.Text; | ||
| 13 | using System.Windows.Forms; | ||
| 14 | using System.Xml; | ||
| 15 | |||
| 16 | namespace WebTest.WebService.Plugin.ResultTab | ||
| 17 | { | ||
| 18 | /// <summary> | ||
| 19 | /// Wrapper for TreeView to enable XML content view | ||
| 20 | /// </summary> | ||
| 21 | public class XmlTreeView | ||
| 22 | { | ||
| 23 | private TreeView treeView; | ||
| 24 | private XmlDocument dom; | ||
| 25 | |||
| 26 | /// <summary> | ||
| 27 | /// Wrapper for TreeView to enable XML content view | ||
| 28 | /// </summary> | ||
| 29 | /// <param name="treeView">TreeView where XML content needs to be shown</param> | ||
| 30 | public XmlTreeView(TreeView treeView) | ||
| 31 | { | ||
| 32 | this.treeView = treeView; | ||
| 33 | treeView.BeforeExpand += new TreeViewCancelEventHandler(TreeExpanded); | ||
| 34 | treeView.AfterLabelEdit += new NodeLabelEditEventHandler(treeViewRequest_AfterLabelEdit); | ||
| 35 | } | ||
| 36 | |||
| 37 | /// <summary> | ||
| 38 | /// Show XML in tree | ||
| 39 | /// </summary> | ||
| 40 | /// <param name="xmlString"></param> | ||
| 41 | /// <returns></returns> | ||
| 42 | public XmlDocument ShowXML(string xmlString) | ||
| 43 | { | ||
| 44 | try | ||
| 45 | { | ||
| 46 | // Load the XML file. | ||
| 47 | this.dom = new XmlDocument(); | ||
| 48 | dom.LoadXml(xmlString); | ||
| 49 | ShowXML(dom); | ||
| 50 | return dom; | ||
| 51 | } | ||
| 52 | catch (Exception) | ||
| 53 | { | ||
| 54 | //MessageBox.Show(ex.Message, "Error"); | ||
| 55 | } | ||
| 56 | return null; | ||
| 57 | } | ||
| 58 | |||
| 59 | /// <summary> | ||
| 60 | /// Show XML in tree | ||
| 61 | /// </summary> | ||
| 62 | /// <param name="reader"></param> | ||
| 63 | /// <returns></returns> | ||
| 64 | public XmlDocument ShowXML(XmlReader reader) | ||
| 65 | { | ||
| 66 | try | ||
| 67 | { | ||
| 68 | // Load the XML file. | ||
| 69 | this.dom = new XmlDocument(); | ||
| 70 | dom.Load(reader); | ||
| 71 | ShowXML(dom); | ||
| 72 | return dom; | ||
| 73 | } | ||
| 74 | catch (Exception) | ||
| 75 | { | ||
| 76 | //MessageBox.Show(ex.Message, "Error"); | ||
| 77 | } | ||
| 78 | return null; | ||
| 79 | } | ||
| 80 | |||
| 81 | /// <summary> | ||
| 82 | /// Show XML in tree | ||
| 83 | /// </summary> | ||
| 84 | /// <param name="dom"></param> | ||
| 85 | public void ShowXML(XmlDocument dom) | ||
| 86 | { | ||
| 87 | try | ||
| 88 | { | ||
| 89 | this.dom = dom; | ||
| 90 | XmlNode xNode = dom.DocumentElement; | ||
| 91 | |||
| 92 | // Load the XML into the TreeView. | ||
| 93 | treeView.Nodes.Clear(); | ||
| 94 | |||
| 95 | TreeNode treeNode = new TreeNode(xNode.Name); | ||
| 96 | treeNode.Tag = xNode; | ||
| 97 | if (xNode.HasChildNodes) | ||
| 98 | { | ||
| 99 | treeNode.Nodes.Add(new TreeNode("dummy")); | ||
| 100 | } | ||
| 101 | else | ||
| 102 | { | ||
| 103 | treeNode.Text = xNode.InnerXml.Trim(); | ||
| 104 | } | ||
| 105 | |||
| 106 | treeView.Nodes.Add(treeNode); | ||
| 107 | treeNode.Collapse(); | ||
| 108 | } | ||
| 109 | catch (Exception ex) | ||
| 110 | { | ||
| 111 | MessageBox.Show(ex.Message, "Error"); | ||
| 112 | } | ||
| 113 | } | ||
| 114 | |||
| 115 | /// <summary> | ||
| 116 | /// Indicates whether message has been edited since last update | ||
| 117 | /// </summary> | ||
| 118 | public bool MessageEdited | ||
| 119 | { | ||
| 120 | get; | ||
| 121 | set; | ||
| 122 | } | ||
| 123 | |||
| 124 | /// <summary> | ||
| 125 | /// replaces currently selected XML node's contents with given parameter name | ||
| 126 | /// </summary> | ||
| 127 | /// <param name="parameterName">name of the parameter</param> | ||
| 128 | public void AddParameter(string parameterName) | ||
| 129 | { | ||
| 130 | TreeNode treeNode = this.treeView.SelectedNode; | ||
| 131 | TreeNode parentTreeNode = treeNode.Parent; | ||
| 132 | if (treeNode != null && parentTreeNode != null) | ||
| 133 | { | ||
| 134 | if (parameterName.Equals("Type Parameter")) | ||
| 135 | { | ||
| 136 | if (!treeNode.IsEditing) | ||
| 137 | { | ||
| 138 | treeNode.BeginEdit(); | ||
| 139 | } | ||
| 140 | return; | ||
| 141 | } | ||
| 142 | |||
| 143 | ParameterizeNode(treeNode, "{{" + parameterName + "}}"); | ||
| 144 | } | ||
| 145 | } | ||
| 146 | |||
| 147 | private void treeViewRequest_AfterLabelEdit(object sender, System.Windows.Forms.NodeLabelEditEventArgs e) | ||
| 148 | { | ||
| 149 | if (e.Label != null) | ||
| 150 | { | ||
| 151 | if (e.Label.Length > 0) | ||
| 152 | { | ||
| 153 | //Stop editing without canceling the label change. | ||
| 154 | e.Node.EndEdit(false); | ||
| 155 | ParameterizeNode(e.Node, e.Label); | ||
| 156 | } | ||
| 157 | else | ||
| 158 | { | ||
| 159 | // Cancel the label edit action, inform the user, and | ||
| 160 | // place the node in edit mode again | ||
| 161 | e.CancelEdit = true; | ||
| 162 | MessageBox.Show("Invalid input.\nThe label cannot be blank", | ||
| 163 | "Node Label Edit"); | ||
| 164 | e.Node.BeginEdit(); | ||
| 165 | } | ||
| 166 | } | ||
| 167 | } | ||
| 168 | |||
| 169 | private void TreeExpanded(object sender, TreeViewCancelEventArgs e) | ||
| 170 | { | ||
| 171 | if (e.Node.Nodes.Count == 1 && e.Node.Nodes[0].Text.Equals("dummy")) | ||
| 172 | { | ||
| 173 | e.Node.Nodes.Clear(); | ||
| 174 | XmlNode parentNode = e.Node.Tag as XmlNode; | ||
| 175 | XmlNodeList nodeList = parentNode.ChildNodes; | ||
| 176 | for (int i = 0; i <= nodeList.Count - 1; i++) | ||
| 177 | { | ||
| 178 | XmlNode xNode = parentNode.ChildNodes[i]; | ||
| 179 | TreeNode treeNode = new TreeNode(); | ||
| 180 | treeNode.Tag = xNode; | ||
| 181 | if (xNode.NodeType.Equals(XmlNodeType.Element)) | ||
| 182 | { | ||
| 183 | treeNode.Text = xNode.Name; | ||
| 184 | if (xNode.HasChildNodes) | ||
| 185 | { | ||
| 186 | treeNode.Nodes.Add(new TreeNode("dummy")); | ||
| 187 | } | ||
| 188 | else | ||
| 189 | { | ||
| 190 | treeNode.Nodes.Add(new TreeNode(xNode.Value)); | ||
| 191 | } | ||
| 192 | } | ||
| 193 | else | ||
| 194 | { | ||
| 195 | treeNode.Text = xNode.Value; | ||
| 196 | } | ||
| 197 | |||
| 198 | e.Node.Nodes.Add(treeNode); | ||
| 199 | treeNode.Collapse(); | ||
| 200 | } | ||
| 201 | } | ||
| 202 | } | ||
| 203 | |||
| 204 | private void ParameterizeNode(TreeNode treeNode, string parameter) | ||
| 205 | { | ||
| 206 | TreeNode parentTreeNode = treeNode.Parent; | ||
| 207 | XmlNode xNode = treeNode.Tag as XmlNode; | ||
| 208 | if (xNode != null) | ||
| 209 | { | ||
| 210 | XmlNode parentXNode = parentTreeNode.Tag as XmlNode; | ||
| 211 | treeNode.Text = parameter; | ||
| 212 | if (xNode is XmlText) | ||
| 213 | { | ||
| 214 | xNode.Value = parameter; | ||
| 215 | } | ||
| 216 | else | ||
| 217 | { | ||
| 218 | XmlText textNode = dom.CreateTextNode(parameter); | ||
| 219 | parentXNode.ReplaceChild(textNode, xNode); | ||
| 220 | treeNode.Tag = textNode; | ||
| 221 | treeNode.Nodes.Clear(); | ||
| 222 | } | ||
| 223 | this.MessageEdited = true; | ||
| 224 | } | ||
| 225 | } | ||
| 226 | } | ||
| 227 | } |
WebTestWebServiceRuntime/ContentHandler.cs
0 → 100644
| 1 | //************************************************************************************************* | ||
| 2 | // ContentHandler.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // Base class for handling a content type | ||
| 6 | // | ||
| 7 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 8 | //************************************************************************************************* | ||
| 9 | using System; | ||
| 10 | using System.Collections.Generic; | ||
| 11 | using System.Linq; | ||
| 12 | using System.Text; | ||
| 13 | using System.Xml; | ||
| 14 | using System.IO; | ||
| 15 | using System.Xml.XPath; | ||
| 16 | |||
| 17 | namespace WebTest.WebService.Plugin.Runtime | ||
| 18 | { | ||
| 19 | /// <summary> | ||
| 20 | /// Base class for handling a content type | ||
| 21 | /// </summary> | ||
| 22 | public class ContentHandler | ||
| 23 | { | ||
| 24 | private string xmlString = string.Empty; | ||
| 25 | private XmlDocument xmlDocument = null; | ||
| 26 | |||
| 27 | /// <summary> | ||
| 28 | /// Is it a binary format? | ||
| 29 | /// </summary> | ||
| 30 | public virtual bool IsBinary | ||
| 31 | { | ||
| 32 | get | ||
| 33 | { | ||
| 34 | return false; | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | /// <summary> | ||
| 39 | /// Raw binary content | ||
| 40 | /// </summary> | ||
| 41 | public virtual Byte[] MessageBytes | ||
| 42 | { | ||
| 43 | get | ||
| 44 | { | ||
| 45 | throw new NotImplementedException(); | ||
| 46 | } | ||
| 47 | set | ||
| 48 | { | ||
| 49 | throw new NotImplementedException(); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | /// <summary> | ||
| 54 | /// Raw string content | ||
| 55 | /// </summary> | ||
| 56 | public virtual string MessageString | ||
| 57 | { | ||
| 58 | get | ||
| 59 | { | ||
| 60 | return XmlToString(this.XmlDocument); | ||
| 61 | } | ||
| 62 | set | ||
| 63 | { | ||
| 64 | this.xmlString = value; | ||
| 65 | this.xmlDocument = null; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | /// <summary> | ||
| 70 | /// message converted to XML | ||
| 71 | /// </summary> | ||
| 72 | public string XmlString | ||
| 73 | { | ||
| 74 | get | ||
| 75 | { | ||
| 76 | return XmlToIndentedString(this.XmlDocument); | ||
| 77 | } | ||
| 78 | set | ||
| 79 | { | ||
| 80 | this.xmlString = value; | ||
| 81 | this.xmlDocument = null; | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | /// <summary> | ||
| 86 | /// XML Document of the message | ||
| 87 | /// </summary> | ||
| 88 | public XmlDocument XmlDocument | ||
| 89 | { | ||
| 90 | get | ||
| 91 | { | ||
| 92 | if (this.xmlDocument == null) | ||
| 93 | { | ||
| 94 | if (string.IsNullOrEmpty(this.xmlString)) | ||
| 95 | { | ||
| 96 | this.LoadDocument(); | ||
| 97 | } | ||
| 98 | else | ||
| 99 | { | ||
| 100 | try | ||
| 101 | { | ||
| 102 | this.xmlDocument = new XmlDocument(); | ||
| 103 | this.xmlDocument.LoadXml(this.xmlString); | ||
| 104 | } | ||
| 105 | catch (Exception) | ||
| 106 | { | ||
| 107 | // Try setting it as a native format message | ||
| 108 | this.MessageString = this.xmlString; | ||
| 109 | this.LoadDocument(); | ||
| 110 | } | ||
| 111 | } | ||
| 112 | } | ||
| 113 | |||
| 114 | return xmlDocument; | ||
| 115 | } | ||
| 116 | set | ||
| 117 | { | ||
| 118 | this.xmlDocument = value; | ||
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 122 | /// <summary> | ||
| 123 | /// XPath document of XML | ||
| 124 | /// </summary> | ||
| 125 | public virtual XPathDocument XPathDocument | ||
| 126 | { | ||
| 127 | get | ||
| 128 | { | ||
| 129 | return new XPathDocument(new StringReader(this.xmlString)); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | /// <summary> | ||
| 134 | /// Evaluates XPath | ||
| 135 | /// </summary> | ||
| 136 | /// <param name="xPath">xPath expression</param> | ||
| 137 | /// <returns></returns> | ||
| 138 | public XPathNodeIterator EvaluateXPath(string xPath) | ||
| 139 | { | ||
| 140 | XPathDocument x = this.XPathDocument; | ||
| 141 | XPathNavigator nav = x.CreateNavigator(); | ||
| 142 | XmlNamespaceManager context = new XmlNamespaceManager(nav.NameTable); | ||
| 143 | while (nav.MoveToFollowing(XPathNodeType.Element)) | ||
| 144 | { | ||
| 145 | IDictionary<string, string> whatever = nav.GetNamespacesInScope(XmlNamespaceScope.All); | ||
| 146 | foreach (KeyValuePair<string, string> key in whatever) | ||
| 147 | { | ||
| 148 | context.AddNamespace(key.Key, key.Value); | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | // Compile a standard XPath expression | ||
| 153 | XPathExpression expr; | ||
| 154 | expr = nav.Compile(xPath); | ||
| 155 | expr.SetContext(context); | ||
| 156 | return nav.Select(expr); | ||
| 157 | } | ||
| 158 | |||
| 159 | /// <summary> | ||
| 160 | /// Override to perform custom load | ||
| 161 | /// </summary> | ||
| 162 | protected virtual void LoadDocument() | ||
| 163 | { | ||
| 164 | } | ||
| 165 | |||
| 166 | /// <summary> | ||
| 167 | /// Converts XmlDocument to String | ||
| 168 | /// </summary> | ||
| 169 | /// <param name="dom"></param> | ||
| 170 | /// <returns></returns> | ||
| 171 | public static string XmlToString(XmlDocument dom) | ||
| 172 | { | ||
| 173 | string message = string.Empty; | ||
| 174 | System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); | ||
| 175 | using (var stream = new MemoryStream()) | ||
| 176 | { | ||
| 177 | using (XmlTextWriter writer = new XmlTextWriter(stream, encoding)) | ||
| 178 | { | ||
| 179 | dom.WriteTo(writer); | ||
| 180 | } | ||
| 181 | message = encoding.GetString(stream.ToArray()); | ||
| 182 | } | ||
| 183 | |||
| 184 | return message; | ||
| 185 | } | ||
| 186 | |||
| 187 | /// <summary> | ||
| 188 | /// Converts XmlDocument to String | ||
| 189 | /// </summary> | ||
| 190 | /// <param name="dom"></param> | ||
| 191 | /// <returns></returns> | ||
| 192 | public static string XmlToIndentedString(XmlDocument dom) | ||
| 193 | { | ||
| 194 | string message = string.Empty; | ||
| 195 | System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); | ||
| 196 | using (var stream = new MemoryStream()) | ||
| 197 | { | ||
| 198 | using (XmlTextWriter writer = new XmlTextWriter(stream, encoding)) | ||
| 199 | { | ||
| 200 | writer.Formatting = Formatting.Indented; | ||
| 201 | dom.WriteTo(writer); | ||
| 202 | } | ||
| 203 | message = encoding.GetString(stream.ToArray()); | ||
| 204 | } | ||
| 205 | |||
| 206 | return message; | ||
| 207 | } | ||
| 208 | |||
| 209 | /// <summary> | ||
| 210 | /// Parses XML in string form and returns XmlDocument | ||
| 211 | /// </summary> | ||
| 212 | /// <param name="xmlString"></param> | ||
| 213 | /// <returns></returns> | ||
| 214 | public static XmlDocument StringToXml(string xmlString) | ||
| 215 | { | ||
| 216 | XmlDocument dom = new XmlDocument(); | ||
| 217 | dom.LoadXml(xmlString); | ||
| 218 | return dom; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | } |
| 1 | //************************************************************************************************* | ||
| 2 | // ContentHandlerFactory.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // Creates appropriate handler for a given content type | ||
| 6 | // | ||
| 7 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 8 | //************************************************************************************************* | ||
| 9 | using System; | ||
| 10 | using System.Collections.Generic; | ||
| 11 | using System.Linq; | ||
| 12 | using System.Text; | ||
| 13 | |||
| 14 | namespace WebTest.WebService.Plugin.Runtime | ||
| 15 | { | ||
| 16 | /// <summary> | ||
| 17 | /// Creates appropriate handler for a given content type | ||
| 18 | /// </summary> | ||
| 19 | public class ContentHandlerFactory | ||
| 20 | { | ||
| 21 | /// <summary> | ||
| 22 | /// Creates appropriate handler for a given content type | ||
| 23 | /// </summary> | ||
| 24 | /// <param name="contentType">content type</param> | ||
| 25 | /// <returns></returns> | ||
| 26 | public static ContentHandler GetHandler(string contentType) | ||
| 27 | { | ||
| 28 | if (contentType.ToLower().Contains("msbin1")) | ||
| 29 | { | ||
| 30 | return new Msbin1ContentHandler(contentType.ToLower().Contains("soap")); | ||
| 31 | } | ||
| 32 | else if (contentType.ToLower().Contains("json")) | ||
| 33 | { | ||
| 34 | return new JsonContentHandler(); | ||
| 35 | } | ||
| 36 | else if (contentType.ToLower().Contains("xml")) | ||
| 37 | { | ||
| 38 | return new ContentHandler(); | ||
| 39 | } | ||
| 40 | else | ||
| 41 | { | ||
| 42 | return null; | ||
| 43 | } | ||
| 44 | } | ||
| 45 | } | ||
| 46 | } |
| 1 | //************************************************************************************************* | ||
| 2 | // DataBindingHelper.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // Data Binding helper class | ||
| 6 | // | ||
| 7 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 8 | //************************************************************************************************* | ||
| 9 | using System; | ||
| 10 | using System.Collections.Generic; | ||
| 11 | using System.Linq; | ||
| 12 | using System.Text; | ||
| 13 | using Microsoft.VisualStudio.TestTools.WebTesting; | ||
| 14 | using System.Globalization; | ||
| 15 | |||
| 16 | namespace WebTest.WebService.Plugin.Runtime | ||
| 17 | { | ||
| 18 | internal class DataBindingHelper | ||
| 19 | { | ||
| 20 | // ************************************************************************ | ||
| 21 | // Updating the binding sites goes through the string and replaces all | ||
| 22 | // sites with the appropriate value found in the context's property bag. | ||
| 23 | // ************************************************************************ | ||
| 24 | internal static string UpdateBindingSites(WebTestContext testCaseContext, string preBoundString) | ||
| 25 | { | ||
| 26 | string bindingSite; | ||
| 27 | int startingIndex = 0; | ||
| 28 | int bindingSiteIndex; | ||
| 29 | int nextStartingIndex = 0; | ||
| 30 | StringBuilder postBoundBuilder = null; | ||
| 31 | |||
| 32 | // Scan the entire length of the string | ||
| 33 | if (!String.IsNullOrEmpty(preBoundString)) | ||
| 34 | { | ||
| 35 | while ((bindingSite = GetNextBindingSite(preBoundString, startingIndex, out bindingSiteIndex, out nextStartingIndex)) != null) | ||
| 36 | { | ||
| 37 | //lazy create the StringBuilder, since many fields will not be context-bound | ||
| 38 | if (postBoundBuilder == null) | ||
| 39 | { | ||
| 40 | postBoundBuilder = new StringBuilder(); | ||
| 41 | } | ||
| 42 | |||
| 43 | // First copy any data up to the start of the binding site | ||
| 44 | postBoundBuilder.Append(preBoundString.Substring(startingIndex, bindingSiteIndex - startingIndex)); | ||
| 45 | |||
| 46 | //advance the starting index to be ready for the next pass | ||
| 47 | startingIndex = nextStartingIndex; | ||
| 48 | |||
| 49 | string boundValue = null; | ||
| 50 | |||
| 51 | if (bindingSite.StartsWith("$", StringComparison.Ordinal) && !bindingSite.StartsWith("$HIDDEN", StringComparison.Ordinal)) | ||
| 52 | { | ||
| 53 | boundValue = GetBindingMacroValue(testCaseContext, bindingSite); | ||
| 54 | } | ||
| 55 | |||
| 56 | if (boundValue == null) | ||
| 57 | { | ||
| 58 | // Now add the value for this binding site to the string | ||
| 59 | if (!testCaseContext.ContainsKey(bindingSite)) | ||
| 60 | { | ||
| 61 | //string message = String.Format(CultureInfo.InvariantCulture, Strings.Get(Strings.BindingSiteException), bindingSite); | ||
| 62 | throw new WebTestException("Data Not Found for:" + bindingSite); | ||
| 63 | } | ||
| 64 | |||
| 65 | boundValue = testCaseContext[bindingSite] as string; | ||
| 66 | if (boundValue == null) | ||
| 67 | { | ||
| 68 | // call ToString() if the value was not a string | ||
| 69 | boundValue = testCaseContext[bindingSite].ToString(); | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | postBoundBuilder.Append(boundValue); | ||
| 74 | } | ||
| 75 | |||
| 76 | //if we actually did any binding, add the rest of the string to the string builder and return the bound string | ||
| 77 | if (postBoundBuilder != null) | ||
| 78 | { | ||
| 79 | postBoundBuilder.Append(preBoundString.Substring(nextStartingIndex)); | ||
| 80 | return postBoundBuilder.ToString(); | ||
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 84 | //no binding occurred, so return the original string | ||
| 85 | return preBoundString; | ||
| 86 | } | ||
| 87 | |||
| 88 | /// <summary> | ||
| 89 | /// Returns the next name of a binding site -- without {{ and }} | ||
| 90 | /// </summary> | ||
| 91 | /// <param name="searchString">The string to search for binding sites.</param> | ||
| 92 | /// <param name="startIndex">The index at which to start looking in the string.</param> | ||
| 93 | /// <param name="startBindingIndex">The index of the first { character in the binding site. Behavior is undefined if no binding site was found.</param> | ||
| 94 | /// <param name="endIndex">The index at which parsing stopped. This should be used as the next starting index.</param> | ||
| 95 | /// <returns></returns> | ||
| 96 | private static string GetNextBindingSite(string searchString, int startIndex, out int startBindingIndex, out int endIndex) | ||
| 97 | { | ||
| 98 | endIndex = startIndex; | ||
| 99 | startBindingIndex = searchString.IndexOf("{{", startIndex, StringComparison.Ordinal); | ||
| 100 | |||
| 101 | if (startBindingIndex == -1) | ||
| 102 | { | ||
| 103 | //no binding was found | ||
| 104 | return null; | ||
| 105 | } | ||
| 106 | |||
| 107 | if (searchString.Length < startBindingIndex + 4) | ||
| 108 | { | ||
| 109 | //this is an error because the string is not long enough for the binding to be closed | ||
| 110 | return null; | ||
| 111 | } | ||
| 112 | |||
| 113 | int endBindingIndex = searchString.IndexOf("}}", startBindingIndex + 2, StringComparison.Ordinal); | ||
| 114 | |||
| 115 | if (endBindingIndex == -1) | ||
| 116 | { | ||
| 117 | //this is an error because the binding is not closed | ||
| 118 | return null; | ||
| 119 | } | ||
| 120 | |||
| 121 | endIndex = endBindingIndex + 2; | ||
| 122 | |||
| 123 | return searchString.Substring(startBindingIndex + 2, endBindingIndex - startBindingIndex - 2); | ||
| 124 | } | ||
| 125 | |||
| 126 | private static string GetBindingMacroValue(WebTestContext testCaseContext, string bindingSite) | ||
| 127 | { | ||
| 128 | if (string.Equals(bindingSite, "$AgentCount", StringComparison.OrdinalIgnoreCase)) | ||
| 129 | { | ||
| 130 | return testCaseContext.AgentCount.ToString(CultureInfo.CurrentCulture); | ||
| 131 | } | ||
| 132 | |||
| 133 | if (string.Equals(bindingSite, "$AgentId", StringComparison.OrdinalIgnoreCase)) | ||
| 134 | { | ||
| 135 | return testCaseContext.AgentId.ToString(CultureInfo.CurrentCulture); | ||
| 136 | } | ||
| 137 | |||
| 138 | if (string.Equals(bindingSite, "$AgentName", StringComparison.OrdinalIgnoreCase)) | ||
| 139 | { | ||
| 140 | return testCaseContext.AgentName; | ||
| 141 | } | ||
| 142 | |||
| 143 | if (string.Equals(bindingSite, "$ControllerName", StringComparison.OrdinalIgnoreCase)) | ||
| 144 | { | ||
| 145 | return testCaseContext.ControllerName; | ||
| 146 | } | ||
| 147 | |||
| 148 | if (string.Equals(bindingSite, "$WebTestUserId", StringComparison.OrdinalIgnoreCase)) | ||
| 149 | { | ||
| 150 | return testCaseContext.WebTestUserId.ToString(CultureInfo.CurrentCulture); | ||
| 151 | } | ||
| 152 | |||
| 153 | if (string.Equals(bindingSite, "$WebTestIteration", StringComparison.OrdinalIgnoreCase)) | ||
| 154 | { | ||
| 155 | return testCaseContext.WebTestIteration.ToString(CultureInfo.CurrentCulture); | ||
| 156 | } | ||
| 157 | |||
| 158 | const string randomIntMacroPrefix = "$RandomInt("; | ||
| 159 | if (bindingSite.StartsWith(randomIntMacroPrefix, StringComparison.OrdinalIgnoreCase) && | ||
| 160 | bindingSite.EndsWith(")", StringComparison.Ordinal)) | ||
| 161 | { | ||
| 162 | Random rand = new Random(); | ||
| 163 | string arguments = bindingSite.Substring(randomIntMacroPrefix.Length, bindingSite.Length - randomIntMacroPrefix.Length - 1); | ||
| 164 | if (arguments.Length == 0) | ||
| 165 | { | ||
| 166 | return rand.Next().ToString(CultureInfo.CurrentCulture); | ||
| 167 | } | ||
| 168 | else if (arguments.Contains(",")) | ||
| 169 | { | ||
| 170 | string[] args = arguments.Split(new char[] { ',' }); | ||
| 171 | if (args.Length == 2) | ||
| 172 | { | ||
| 173 | try | ||
| 174 | { | ||
| 175 | return rand.Next( | ||
| 176 | int.Parse(args[0], CultureInfo.InvariantCulture), | ||
| 177 | int.Parse(args[1], CultureInfo.InvariantCulture)).ToString(CultureInfo.CurrentCulture); | ||
| 178 | } | ||
| 179 | catch | ||
| 180 | { | ||
| 181 | } | ||
| 182 | } | ||
| 183 | } | ||
| 184 | else | ||
| 185 | { | ||
| 186 | try | ||
| 187 | { | ||
| 188 | return rand.Next(int.Parse(arguments, CultureInfo.InvariantCulture)).ToString(CultureInfo.CurrentCulture); | ||
| 189 | } | ||
| 190 | catch | ||
| 191 | { | ||
| 192 | } | ||
| 193 | } | ||
| 194 | } | ||
| 195 | |||
| 196 | const string randomDoubleMacroPrefix = "$RandomDouble("; | ||
| 197 | if (bindingSite.StartsWith(randomDoubleMacroPrefix, StringComparison.OrdinalIgnoreCase) && | ||
| 198 | bindingSite.EndsWith(")", StringComparison.Ordinal)) | ||
| 199 | { | ||
| 200 | Random rand = new Random(); | ||
| 201 | string arguments = bindingSite.Substring(randomDoubleMacroPrefix.Length, bindingSite.Length - randomDoubleMacroPrefix.Length - 1); | ||
| 202 | if (arguments.Length == 0) | ||
| 203 | { | ||
| 204 | return rand.NextDouble().ToString(CultureInfo.CurrentCulture); | ||
| 205 | } | ||
| 206 | else if (arguments.Contains(",")) | ||
| 207 | { | ||
| 208 | string[] args = arguments.Split(new char[] { ',' }); | ||
| 209 | if (args.Length == 2) | ||
| 210 | { | ||
| 211 | try | ||
| 212 | { | ||
| 213 | double min = double.Parse(args[0], CultureInfo.InvariantCulture); | ||
| 214 | double max = double.Parse(args[1], CultureInfo.InvariantCulture); | ||
| 215 | double range = max - min; | ||
| 216 | |||
| 217 | double randValue = min + (range * rand.NextDouble()); | ||
| 218 | return randValue.ToString(CultureInfo.CurrentCulture); | ||
| 219 | } | ||
| 220 | catch | ||
| 221 | { | ||
| 222 | } | ||
| 223 | } | ||
| 224 | } | ||
| 225 | else | ||
| 226 | { | ||
| 227 | try | ||
| 228 | { | ||
| 229 | double randValue = double.Parse(arguments, CultureInfo.InvariantCulture) * rand.NextDouble(); | ||
| 230 | return randValue.ToString(CultureInfo.CurrentCulture); | ||
| 231 | } | ||
| 232 | catch | ||
| 233 | { | ||
| 234 | } | ||
| 235 | } | ||
| 236 | } | ||
| 237 | |||
| 238 | return null; | ||
| 239 | } | ||
| 240 | } | ||
| 241 | } |
| 1 | //************************************************************************************************* | ||
| 2 | // JsonContentHandler.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // Encode/decode JSON format for Web Service response. converts JSON into XML back and forth | ||
| 6 | // | ||
| 7 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 8 | //************************************************************************************************* | ||
| 9 | using System; | ||
| 10 | using System.Collections.Generic; | ||
| 11 | using System.Linq; | ||
| 12 | using System.Text; | ||
| 13 | using System.Xml; | ||
| 14 | using System.Runtime.Serialization.Json; | ||
| 15 | using System.IO; | ||
| 16 | using System.Xml.XPath; | ||
| 17 | |||
| 18 | namespace WebTest.WebService.Plugin.Runtime | ||
| 19 | { | ||
| 20 | public class JsonContentHandler : ContentHandler | ||
| 21 | { | ||
| 22 | public override string MessageString | ||
| 23 | { | ||
| 24 | get | ||
| 25 | { | ||
| 26 | string message = string.Empty; | ||
| 27 | System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); | ||
| 28 | |||
| 29 | using (var stream = new MemoryStream()) | ||
| 30 | { | ||
| 31 | using (XmlDictionaryWriter writer = JsonReaderWriterFactory.CreateJsonWriter(stream, encoding)) | ||
| 32 | { | ||
| 33 | this.XmlDocument.WriteTo(writer); | ||
| 34 | } | ||
| 35 | message = encoding.GetString(stream.ToArray()); | ||
| 36 | } | ||
| 37 | |||
| 38 | return message; | ||
| 39 | } | ||
| 40 | set | ||
| 41 | { | ||
| 42 | this.jsonMessage = value; | ||
| 43 | this.XmlString = string.Empty; | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | public override XPathDocument XPathDocument | ||
| 48 | { | ||
| 49 | get | ||
| 50 | { | ||
| 51 | return new XPathDocument(GetReader()); | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | protected override void LoadDocument() | ||
| 56 | { | ||
| 57 | try | ||
| 58 | { | ||
| 59 | this.XmlDocument = new XmlDocument(); | ||
| 60 | this.XmlDocument.Load(GetReader()); | ||
| 61 | } | ||
| 62 | catch (Exception) | ||
| 63 | { | ||
| 64 | // try setting it as an XML | ||
| 65 | this.XmlString = jsonMessage; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | private XmlDictionaryReader GetReader() | ||
| 70 | { | ||
| 71 | System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); | ||
| 72 | |||
| 73 | XmlDictionaryReader jsonReader = | ||
| 74 | System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonReader( | ||
| 75 | encoding.GetBytes(this.jsonMessage), | ||
| 76 | XmlDictionaryReaderQuotas.Max); | ||
| 77 | |||
| 78 | return jsonReader; | ||
| 79 | } | ||
| 80 | |||
| 81 | private string jsonMessage = string.Empty; | ||
| 82 | } | ||
| 83 | } |
| 1 | //************************************************************************************************* | ||
| 2 | // Msbin1ContentHandler.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // Encode/decode MSBin1 binary format for Web Service response | ||
| 6 | // When the Web Service response is 'application/soap+msbin1 or application/msbin1' | ||
| 7 | // (binary - used by Silverlight application with WCF RIA) | ||
| 8 | // | ||
| 9 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 10 | //************************************************************************************************* | ||
| 11 | using System; | ||
| 12 | using System.Collections.Generic; | ||
| 13 | using System.Linq; | ||
| 14 | using System.Text; | ||
| 15 | using System.Xml; | ||
| 16 | using System.ServiceModel.Channels; | ||
| 17 | using System.IO; | ||
| 18 | |||
| 19 | namespace WebTest.WebService.Plugin.Runtime | ||
| 20 | { | ||
| 21 | public class Msbin1ContentHandler : ContentHandler | ||
| 22 | { | ||
| 23 | private static readonly BufferManager _bufferManager = BufferManager.CreateBufferManager(int.MaxValue, int.MaxValue); | ||
| 24 | |||
| 25 | public Msbin1ContentHandler(bool isSoapMessage) | ||
| 26 | { | ||
| 27 | soapMessage = isSoapMessage; | ||
| 28 | } | ||
| 29 | |||
| 30 | public override Byte[] MessageBytes | ||
| 31 | { | ||
| 32 | get | ||
| 33 | { | ||
| 34 | MemoryStream memStream = new MemoryStream(); | ||
| 35 | if (soapMessage) | ||
| 36 | { | ||
| 37 | // Encrypt result back into binary data | ||
| 38 | XmlWriter meWrite = XmlWriter.Create(memStream); | ||
| 39 | meWrite.WriteRaw(this.MessageString); | ||
| 40 | meWrite.Flush(); | ||
| 41 | memStream.Position = 0; | ||
| 42 | |||
| 43 | XmlReader meRead = XmlReader.Create(memStream); | ||
| 44 | Message newMessage = Message.CreateMessage(meRead, int.MaxValue, originalMessage.Version); | ||
| 45 | var bindingElement = new BinaryMessageEncodingBindingElement(); | ||
| 46 | var factory = bindingElement.CreateMessageEncoderFactory(); | ||
| 47 | using (MemoryStream memoryStream = new MemoryStream()) | ||
| 48 | { | ||
| 49 | factory.Encoder.WriteMessage(newMessage, memoryStream); | ||
| 50 | return memoryStream.ToArray(); | ||
| 51 | } | ||
| 52 | } | ||
| 53 | else | ||
| 54 | { | ||
| 55 | XmlDictionaryWriter meWrite = XmlDictionaryWriter.CreateBinaryWriter(memStream); | ||
| 56 | XmlDocument document = StringToXml(this.MessageString); | ||
| 57 | document.Save(meWrite); | ||
| 58 | return memStream.ToArray(); | ||
| 59 | } | ||
| 60 | } | ||
| 61 | set | ||
| 62 | { | ||
| 63 | this.messageBytes = value; | ||
| 64 | // Decrypt body bytes to string | ||
| 65 | |||
| 66 | if (soapMessage) | ||
| 67 | { | ||
| 68 | var bindingElement = new BinaryMessageEncodingBindingElement(); | ||
| 69 | var factory = bindingElement.CreateMessageEncoderFactory(); | ||
| 70 | originalMessage = factory.Encoder.ReadMessage(new ArraySegment<byte>(messageBytes), _bufferManager); | ||
| 71 | this.MessageString = originalMessage.ToString(); | ||
| 72 | } | ||
| 73 | else | ||
| 74 | { | ||
| 75 | XmlDictionaryReader reader = XmlDictionaryReader.CreateBinaryReader(messageBytes, XmlDictionaryReaderQuotas.Max); | ||
| 76 | |||
| 77 | XmlDocument document = new XmlDocument(); | ||
| 78 | document.Load(reader); | ||
| 79 | this.MessageString = XmlToString(document); | ||
| 80 | } | ||
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 84 | public override bool IsBinary | ||
| 85 | { | ||
| 86 | get | ||
| 87 | { | ||
| 88 | return true; | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | private byte[] messageBytes = null; | ||
| 93 | private Message originalMessage = null; | ||
| 94 | private bool soapMessage = false; | ||
| 95 | } | ||
| 96 | } |
| 1 | using System.Reflection; | ||
| 2 | using System.Runtime.CompilerServices; | ||
| 3 | using System.Runtime.InteropServices; | ||
| 4 | |||
| 5 | // General Information about an assembly is controlled through the following | ||
| 6 | // set of attributes. Change these attribute values to modify the information | ||
| 7 | // associated with an assembly. | ||
| 8 | [assembly: AssemblyTitle("WebTestSilverLightPlugin")] | ||
| 9 | [assembly: AssemblyDescription("")] | ||
| 10 | [assembly: AssemblyConfiguration("")] | ||
| 11 | [assembly: AssemblyCompany("Microsoft IT")] | ||
| 12 | [assembly: AssemblyProduct("WebTestSilverLightPlugin")] | ||
| 13 | [assembly: AssemblyCopyright("Copyright © Microsoft IT 2010")] | ||
| 14 | [assembly: AssemblyTrademark("")] | ||
| 15 | [assembly: AssemblyCulture("")] | ||
| 16 | |||
| 17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
| 18 | // to COM components. If you need to access a type in this assembly from | ||
| 19 | // COM, set the ComVisible attribute to true on that type. | ||
| 20 | [assembly: ComVisible(false)] | ||
| 21 | |||
| 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
| 23 | [assembly: Guid("88c51893-3ea0-4a7b-8942-cf06ba21bf79")] | ||
| 24 | |||
| 25 | // Version information for an assembly consists of the following four values: | ||
| 26 | // | ||
| 27 | // Major Version | ||
| 28 | // Minor Version | ||
| 29 | // Build Number | ||
| 30 | // Revision | ||
| 31 | // | ||
| 32 | // You can specify all the values or you can default the Build and Revision Numbers | ||
| 33 | // by using the '*' as shown below: | ||
| 34 | // [assembly: AssemblyVersion("1.0.*")] | ||
| 35 | [assembly: AssemblyVersion("1.0.0.0")] | ||
| 36 | [assembly: AssemblyFileVersion("1.0.0.0")] |
WebTestWebServiceRuntime/WebServicePlugin.cs
0 → 100644
| 1 | //************************************************************************************************* | ||
| 2 | // WebServicePlugin.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // This Web Test plugin performs Data Binding on binary format for Web Service response | ||
| 6 | // When the Web Service response is 'application/soap+msbin1' | ||
| 7 | // (binary - used by Silverlight application with WCF RIA) | ||
| 8 | // | ||
| 9 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 10 | //************************************************************************************************* | ||
| 11 | using Microsoft.VisualStudio.TestTools.WebTesting; | ||
| 12 | using System.Diagnostics.CodeAnalysis; | ||
| 13 | |||
| 14 | namespace WebTest.WebService.Plugin.Runtime | ||
| 15 | { | ||
| 16 | public class WebServicePlugin : WebTestPlugin | ||
| 17 | { | ||
| 18 | /// Summary: | ||
| 19 | /// When overridden in a derived class, represents the method that will handle | ||
| 20 | /// the event associated with the completion of a Web page. | ||
| 21 | /// | ||
| 22 | /// Parameters: | ||
| 23 | /// sender: | ||
| 24 | /// The source of the event. | ||
| 25 | /// | ||
| 26 | /// e: | ||
| 27 | /// A PostPageEventArgs that contains the event data. | ||
| 28 | /// | ||
| 29 | [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] | ||
| 30 | public override void PostPage(object sender, PostPageEventArgs e) | ||
| 31 | { | ||
| 32 | } | ||
| 33 | |||
| 34 | // | ||
| 35 | // Summary: | ||
| 36 | // When overridden in a derived class, represents the method that will handle | ||
| 37 | // the event associated with the completion of an HTTP request. | ||
| 38 | // | ||
| 39 | // Parameters: | ||
| 40 | // sender: | ||
| 41 | // The source of the event. | ||
| 42 | // | ||
| 43 | // e: | ||
| 44 | // A PostRequestEventArgs that contains the event data. | ||
| 45 | [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] | ||
| 46 | public override void PostRequest(object sender, PostRequestEventArgs e) | ||
| 47 | { | ||
| 48 | } | ||
| 49 | |||
| 50 | // | ||
| 51 | // Summary: | ||
| 52 | // When overridden in a derived class, represents the method that will handle | ||
| 53 | // the event associated with the completion of a transaction that is defined | ||
| 54 | // in the Web test. | ||
| 55 | // | ||
| 56 | // Parameters: | ||
| 57 | // sender: | ||
| 58 | // The source of the event. | ||
| 59 | // | ||
| 60 | // e: | ||
| 61 | // A PostTransactionEventArgs that contains the event data. | ||
| 62 | [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] | ||
| 63 | public override void PostTransaction(object sender, PostTransactionEventArgs e) | ||
| 64 | { | ||
| 65 | } | ||
| 66 | |||
| 67 | // | ||
| 68 | // Summary: | ||
| 69 | // When overridden in a derived class, represents the method that will handle | ||
| 70 | // the event associated with the end of a Web test. | ||
| 71 | // | ||
| 72 | // Parameters: | ||
| 73 | // sender: | ||
| 74 | // The source of the event. | ||
| 75 | // | ||
| 76 | // e: | ||
| 77 | // A Microsoft.VisualStudio.TestTools.WebTesting.PostWebTestEventArgs that contains | ||
| 78 | // the event data. | ||
| 79 | [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] | ||
| 80 | public override void PostWebTest(object sender, PostWebTestEventArgs e) | ||
| 81 | { | ||
| 82 | } | ||
| 83 | |||
| 84 | // | ||
| 85 | // Summary: | ||
| 86 | // When overridden in a derived class, represents the method that will handle | ||
| 87 | // the event associated with the start of a Web page. | ||
| 88 | // | ||
| 89 | // Parameters: | ||
| 90 | // sender: | ||
| 91 | // The source of the event. | ||
| 92 | // | ||
| 93 | // e: | ||
| 94 | // A PrePageEventArgs that contains the event data. | ||
| 95 | [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] | ||
| 96 | public override void PrePage(object sender, PrePageEventArgs e) | ||
| 97 | { | ||
| 98 | } | ||
| 99 | |||
| 100 | // | ||
| 101 | // Summary: | ||
| 102 | // When overridden in a derived class, represents the method that will handle | ||
| 103 | // the event associated with the start of an HTTP request. | ||
| 104 | // | ||
| 105 | // Parameters: | ||
| 106 | // sender: | ||
| 107 | // The source of the event. | ||
| 108 | // | ||
| 109 | // e: | ||
| 110 | // A PreRequestEventArgs that contains the event data. | ||
| 111 | [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] | ||
| 112 | public override void PreRequest(object sender, PreRequestEventArgs e) | ||
| 113 | { | ||
| 114 | } | ||
| 115 | |||
| 116 | /// <summary> | ||
| 117 | /// This method performs Data Binding on MSBin1 binray format for Web Service response | ||
| 118 | /// When the Web Service response is 'application/soap+msbin1' | ||
| 119 | // (binary - used by Silverlight application with WCF RIA) | ||
| 120 | /// </summary> | ||
| 121 | /// <param name="sender"></param> | ||
| 122 | /// <param name="e"></param> | ||
| 123 | [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] | ||
| 124 | public override void PreRequestDataBinding(object sender, PreRequestDataBindingEventArgs e) | ||
| 125 | { | ||
| 126 | BinaryHttpBody binaryHttpBody = e.Request.Body as BinaryHttpBody; | ||
| 127 | if (binaryHttpBody == null || string.IsNullOrEmpty(binaryHttpBody.ContentType)) | ||
| 128 | { | ||
| 129 | return; | ||
| 130 | } | ||
| 131 | |||
| 132 | if (!binaryHttpBody.ContentType.Contains("msbin1")) | ||
| 133 | { | ||
| 134 | return; | ||
| 135 | } | ||
| 136 | |||
| 137 | ContentHandler contentHandler = ContentHandlerFactory.GetHandler(binaryHttpBody.ContentType); | ||
| 138 | if (contentHandler != null) | ||
| 139 | { | ||
| 140 | contentHandler.MessageBytes = binaryHttpBody.Data; | ||
| 141 | |||
| 142 | string text = contentHandler.MessageString; | ||
| 143 | |||
| 144 | // do Data Binding on the string version of binary data | ||
| 145 | string newText = DataBindingHelper.UpdateBindingSites(e.WebTest.Context, text); | ||
| 146 | |||
| 147 | contentHandler.MessageString = newText; | ||
| 148 | |||
| 149 | // set the new binary data into http body | ||
| 150 | binaryHttpBody.Data = contentHandler.MessageBytes; | ||
| 151 | } | ||
| 152 | } | ||
| 153 | |||
| 154 | // | ||
| 155 | // Summary: | ||
| 156 | // When overridden in a derived class, represents the method that will handle | ||
| 157 | // the event associated with the start of a transaction that is defined in the | ||
| 158 | // Web test. | ||
| 159 | // | ||
| 160 | // Parameters: | ||
| 161 | // sender: | ||
| 162 | // The source of the event. | ||
| 163 | // | ||
| 164 | // e: | ||
| 165 | // A PreTransactionEventArgs that contains the event data. | ||
| 166 | [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] | ||
| 167 | public override void PreTransaction(object sender, PreTransactionEventArgs e) | ||
| 168 | { | ||
| 169 | } | ||
| 170 | |||
| 171 | // | ||
| 172 | // Summary: | ||
| 173 | // When overridden in a derived class, represents the method that will handle | ||
| 174 | // the event associated with the start of a Web test. | ||
| 175 | // | ||
| 176 | // Parameters: | ||
| 177 | // sender: | ||
| 178 | // The source of the event. | ||
| 179 | // | ||
| 180 | // e: | ||
| 181 | // A Microsoft.VisualStudio.TestTools.WebTesting.PostWebTestEventArgs that contains | ||
| 182 | // the event data. | ||
| 183 | [SuppressMessage("Microsoft.Security", "CA2109:ReviewVisibleEventHandlers")] | ||
| 184 | public override void PreWebTest(object sender, PreWebTestEventArgs e) | ||
| 185 | { | ||
| 186 | } | ||
| 187 | } | ||
| 188 | } |
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| 3 | <PropertyGroup> | ||
| 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| 5 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| 6 | <ProductVersion>8.0.30703</ProductVersion> | ||
| 7 | <SchemaVersion>2.0</SchemaVersion> | ||
| 8 | <ProjectGuid>{F9E36CFA-A657-4DD4-BD17-BA3D91EB469F}</ProjectGuid> | ||
| 9 | <OutputType>Library</OutputType> | ||
| 10 | <AppDesignerFolder>Properties</AppDesignerFolder> | ||
| 11 | <RootNamespace>WebTest.WebService.Plugin.Runtime</RootNamespace> | ||
| 12 | <AssemblyName>WebTest.WebService.Plugin.Runtime</AssemblyName> | ||
| 13 | <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
| 14 | <FileAlignment>512</FileAlignment> | ||
| 15 | <SccProjectName>SAK</SccProjectName> | ||
| 16 | <SccLocalPath>SAK</SccLocalPath> | ||
| 17 | <SccAuxPath>SAK</SccAuxPath> | ||
| 18 | <SccProvider>SAK</SccProvider> | ||
| 19 | <TargetFrameworkProfile /> | ||
| 20 | </PropertyGroup> | ||
| 21 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
| 22 | <DebugSymbols>true</DebugSymbols> | ||
| 23 | <DebugType>full</DebugType> | ||
| 24 | <Optimize>false</Optimize> | ||
| 25 | <OutputPath>bin\Debug\</OutputPath> | ||
| 26 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
| 27 | <ErrorReport>prompt</ErrorReport> | ||
| 28 | <WarningLevel>4</WarningLevel> | ||
| 29 | <Prefer32Bit>false</Prefer32Bit> | ||
| 30 | </PropertyGroup> | ||
| 31 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
| 32 | <DebugType>pdbonly</DebugType> | ||
| 33 | <Optimize>true</Optimize> | ||
| 34 | <OutputPath>bin\Release\</OutputPath> | ||
| 35 | <DefineConstants>TRACE</DefineConstants> | ||
| 36 | <ErrorReport>prompt</ErrorReport> | ||
| 37 | <WarningLevel>4</WarningLevel> | ||
| 38 | <Prefer32Bit>false</Prefer32Bit> | ||
| 39 | </PropertyGroup> | ||
| 40 | <ItemGroup> | ||
| 41 | <Reference Include="Microsoft.VisualStudio.QualityTools.WebTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> | ||
| 42 | <Reference Include="System" /> | ||
| 43 | <Reference Include="System.Core" /> | ||
| 44 | <Reference Include="System.Runtime.Serialization" /> | ||
| 45 | <Reference Include="System.ServiceModel" /> | ||
| 46 | <Reference Include="System.Xml.Linq" /> | ||
| 47 | <Reference Include="System.Data.DataSetExtensions" /> | ||
| 48 | <Reference Include="Microsoft.CSharp" /> | ||
| 49 | <Reference Include="System.Data" /> | ||
| 50 | <Reference Include="System.Xml" /> | ||
| 51 | </ItemGroup> | ||
| 52 | <ItemGroup> | ||
| 53 | <Compile Include="JsonContentHandler.cs" /> | ||
| 54 | <Compile Include="ContentHandler.cs" /> | ||
| 55 | <Compile Include="ContentHandlerFactory.cs" /> | ||
| 56 | <Compile Include="DataBindingHelper.cs" /> | ||
| 57 | <Compile Include="Msbin1ContentHandler.cs" /> | ||
| 58 | <Compile Include="WebServicePlugin.cs" /> | ||
| 59 | <Compile Include="Properties\AssemblyInfo.cs" /> | ||
| 60 | <Compile Include="XPathExtractionRule.cs" /> | ||
| 61 | <Compile Include="XPathValidationRule.cs" /> | ||
| 62 | </ItemGroup> | ||
| 63 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
| 64 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
| 65 | Other similar extension points exist, see Microsoft.Common.targets. | ||
| 66 | <Target Name="BeforeBuild"> | ||
| 67 | </Target> | ||
| 68 | <Target Name="AfterBuild"> | ||
| 69 | </Target> | ||
| 70 | --> | ||
| 71 | </Project> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | //************************************************************************************************* | ||
| 2 | // XPathExtractionRule.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // This web test plugin extracts data from a Web Service response using XPath expression. | ||
| 6 | // The Web Service response can be plain XML or 'application/soap+msbin1' | ||
| 7 | // (binary - used by Silverlight application with WCF RIA) or JSON | ||
| 8 | // | ||
| 9 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 10 | //************************************************************************************************* | ||
| 11 | using System; | ||
| 12 | using System.Collections.Generic; | ||
| 13 | using System.Linq; | ||
| 14 | using System.Text; | ||
| 15 | using System.ComponentModel; | ||
| 16 | using Microsoft.VisualStudio.TestTools.WebTesting; | ||
| 17 | using System.Xml.XPath; | ||
| 18 | using System.Xml; | ||
| 19 | using System.IO; | ||
| 20 | |||
| 21 | namespace WebTest.WebService.Plugin.Runtime | ||
| 22 | { | ||
| 23 | [DisplayName("XPathExtractionRule")] | ||
| 24 | [Description("Extracts a value using XPath expression")] | ||
| 25 | public class XPathExtractionRule : ExtractionRule | ||
| 26 | { | ||
| 27 | // The name of the desired input field | ||
| 28 | private string xPathValue; | ||
| 29 | [DisplayName("XPathToSearch")] | ||
| 30 | [Description("Extracts a value using XPath expression")] | ||
| 31 | public string XPathToSearch | ||
| 32 | { | ||
| 33 | get { return xPathValue; } | ||
| 34 | set { xPathValue = value; } | ||
| 35 | } | ||
| 36 | |||
| 37 | // To set a default value use:[DefaultValue(<value>)] | ||
| 38 | private int indexValue; | ||
| 39 | [Description("Indicates which occurrence of the string to extract. This is zero-based index.")] | ||
| 40 | public int Index | ||
| 41 | { | ||
| 42 | get { return indexValue; } | ||
| 43 | set { indexValue = value; } | ||
| 44 | } | ||
| 45 | |||
| 46 | private bool randomMatch; | ||
| 47 | [DisplayName("ExtractRandomMatch")] | ||
| 48 | [Description("If true, all matches are found and one of the matches is randomly returned.")] | ||
| 49 | public bool ExtractRandomMatch | ||
| 50 | { | ||
| 51 | get { return randomMatch; } | ||
| 52 | set { randomMatch = value; } | ||
| 53 | } | ||
| 54 | |||
| 55 | /// <summary> | ||
| 56 | /// The Extract method. The parameter e contains the Web test context. | ||
| 57 | /// </summary> | ||
| 58 | /// <param name="sender"></param> | ||
| 59 | /// <param name="e"></param> | ||
| 60 | public override void Extract(object sender, ExtractionEventArgs e) | ||
| 61 | { | ||
| 62 | try | ||
| 63 | { | ||
| 64 | ContentHandler contentHandler = ContentHandlerFactory.GetHandler(e.Response.ContentType); | ||
| 65 | if (contentHandler == null) | ||
| 66 | { | ||
| 67 | return; | ||
| 68 | } | ||
| 69 | |||
| 70 | if (contentHandler.IsBinary) | ||
| 71 | { | ||
| 72 | contentHandler.MessageBytes = e.Response.BodyBytes; | ||
| 73 | } | ||
| 74 | else | ||
| 75 | { | ||
| 76 | contentHandler.MessageString = e.Response.BodyString; | ||
| 77 | } | ||
| 78 | |||
| 79 | XPathNodeIterator iterator = contentHandler.EvaluateXPath(XPathToSearch); | ||
| 80 | |||
| 81 | List<string> values = new List<string>(); | ||
| 82 | |||
| 83 | int i = 0; | ||
| 84 | while (iterator.MoveNext()) | ||
| 85 | { | ||
| 86 | XPathNavigator nav2 = iterator.Current.Clone(); | ||
| 87 | |||
| 88 | string value; | ||
| 89 | if (nav2.NodeType.Equals(XPathNodeType.Element)) | ||
| 90 | { | ||
| 91 | value = nav2.InnerXml; | ||
| 92 | } | ||
| 93 | else | ||
| 94 | { | ||
| 95 | value = nav2.Value; | ||
| 96 | } | ||
| 97 | |||
| 98 | values.Add(value); | ||
| 99 | if (!ExtractRandomMatch && (i == Index)) | ||
| 100 | { | ||
| 101 | // add the extracted value to the Web test context | ||
| 102 | e.WebTest.Context.Add(this.ContextParameterName, value); | ||
| 103 | e.Success = true; | ||
| 104 | return; | ||
| 105 | } | ||
| 106 | i++; | ||
| 107 | } | ||
| 108 | |||
| 109 | if (ExtractRandomMatch && (values.Count > 0)) | ||
| 110 | { | ||
| 111 | Random random = new Random(); | ||
| 112 | e.WebTest.Context.Add(this.ContextParameterName, values[random.Next(values.Count)]); | ||
| 113 | e.Success = true; | ||
| 114 | return; | ||
| 115 | } | ||
| 116 | } | ||
| 117 | catch (Exception ex) | ||
| 118 | { | ||
| 119 | e.Message = ex.Message; | ||
| 120 | } | ||
| 121 | |||
| 122 | e.Success = false; | ||
| 123 | return; | ||
| 124 | } | ||
| 125 | } | ||
| 126 | } |
| 1 | //************************************************************************************************* | ||
| 2 | // XPathValidationRule.cs | ||
| 3 | // Owner: Mahipal Kante | ||
| 4 | // | ||
| 5 | // This web test plugin validates a Web Service response using XPath expression. | ||
| 6 | // The Web Service response can be plain XML or 'application/soap+msbin1' | ||
| 7 | // (binary - used by Silverlight application with WCF RIA) or JSON | ||
| 8 | // | ||
| 9 | // Copyright(c) Microsoft Corporation, 2010 | ||
| 10 | //************************************************************************************************* | ||
| 11 | using System; | ||
| 12 | using System.Collections.Generic; | ||
| 13 | using System.Linq; | ||
| 14 | using System.Text; | ||
| 15 | using System.ComponentModel; | ||
| 16 | using Microsoft.VisualStudio.TestTools.WebTesting; | ||
| 17 | using System.Xml.XPath; | ||
| 18 | using System.IO; | ||
| 19 | using System.Xml; | ||
| 20 | |||
| 21 | namespace WebTest.WebService.Plugin.Runtime | ||
| 22 | { | ||
| 23 | [DisplayName("XPathValidationRule")] | ||
| 24 | [Description("Validates response using XPath expression")] | ||
| 25 | public class XPathValidationRule : ValidationRule | ||
| 26 | { | ||
| 27 | // The name of the desired input field | ||
| 28 | private string xPathValue; | ||
| 29 | [DisplayName("XPathToSearch")] | ||
| 30 | [Description("XPath expression to evaluate")] | ||
| 31 | public string XPathToSearch | ||
| 32 | { | ||
| 33 | get { return xPathValue; } | ||
| 34 | set { xPathValue = value; } | ||
| 35 | } | ||
| 36 | |||
| 37 | private int indexValue = -1; | ||
| 38 | [Description("Indicates which occurrence of the XPath result to validate. This is a zero based index. -1 indicates try and match against all of them.")] | ||
| 39 | public int Index | ||
| 40 | { | ||
| 41 | get { return indexValue; } | ||
| 42 | set { indexValue = value; } | ||
| 43 | } | ||
| 44 | |||
| 45 | private string expectedValue = string.Empty; | ||
| 46 | [DisplayName("ExpectedValue")] | ||
| 47 | [Description("The Expected result of XPath evaluation")] | ||
| 48 | public string ExpectedValue | ||
| 49 | { | ||
| 50 | get { return expectedValue; } | ||
| 51 | set { expectedValue = value; } | ||
| 52 | } | ||
| 53 | |||
| 54 | private bool ignoreCase = true; | ||
| 55 | [DisplayName("IgnoreCase")] | ||
| 56 | [Description("Ignores case when comparing the result of XPath with the expected value")] | ||
| 57 | public bool IgnoreCase | ||
| 58 | { | ||
| 59 | get { return ignoreCase; } | ||
| 60 | set { ignoreCase = value; } | ||
| 61 | } | ||
| 62 | |||
| 63 | /// <summary> | ||
| 64 | /// The Validation method. The parameter e contains the Web test context. | ||
| 65 | /// </summary> | ||
| 66 | /// <param name="sender"></param> | ||
| 67 | /// <param name="e"></param> | ||
| 68 | public override void Validate(object sender, ValidationEventArgs e) | ||
| 69 | { | ||
| 70 | try | ||
| 71 | { | ||
| 72 | ContentHandler contentHandler = ContentHandlerFactory.GetHandler(e.Response.ContentType); | ||
| 73 | if (contentHandler == null) | ||
| 74 | { | ||
| 75 | return; | ||
| 76 | } | ||
| 77 | |||
| 78 | if (contentHandler.IsBinary) | ||
| 79 | { | ||
| 80 | contentHandler.MessageBytes = e.Response.BodyBytes; | ||
| 81 | } | ||
| 82 | else | ||
| 83 | { | ||
| 84 | contentHandler.MessageString = e.Response.BodyString; | ||
| 85 | } | ||
| 86 | |||
| 87 | XPathNodeIterator iterator = contentHandler.EvaluateXPath(XPathToSearch); | ||
| 88 | int i = 0; | ||
| 89 | while (iterator.MoveNext()) | ||
| 90 | { | ||
| 91 | XPathNavigator nav2 = iterator.Current.Clone(); | ||
| 92 | if ((i == -1) || (i == Index)) | ||
| 93 | { | ||
| 94 | string value; | ||
| 95 | if (nav2.NodeType.Equals(XPathNodeType.Element)) | ||
| 96 | { | ||
| 97 | value = nav2.InnerXml; | ||
| 98 | } | ||
| 99 | else | ||
| 100 | { | ||
| 101 | value = nav2.Value; | ||
| 102 | } | ||
| 103 | |||
| 104 | |||
| 105 | if (ignoreCase) | ||
| 106 | { | ||
| 107 | e.IsValid = ExpectedValue.Equals(value, StringComparison.OrdinalIgnoreCase); | ||
| 108 | } | ||
| 109 | else | ||
| 110 | { | ||
| 111 | e.IsValid = ExpectedValue.Equals(value, StringComparison.Ordinal); | ||
| 112 | } | ||
| 113 | |||
| 114 | if (i == Index || e.IsValid) | ||
| 115 | { | ||
| 116 | return; | ||
| 117 | } | ||
| 118 | } | ||
| 119 | i++; | ||
| 120 | } | ||
| 121 | } | ||
| 122 | catch (Exception ex) | ||
| 123 | { | ||
| 124 | e.Message = ex.Message; | ||
| 125 | } | ||
| 126 | |||
| 127 | e.IsValid = false; | ||
| 128 | return; | ||
| 129 | } | ||
| 130 | } | ||
| 131 | } |
WebTestWebServiceSetup/Product.wxs
0 → 100644
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
| 3 | |||
| 4 | <Product Id="{289E27D1-0F89-4F1A-A2C7-9584091B9950}" Name="Web Test Plugin for Web Service Messages - VS 2012" Language="1033" Version="3.0.0.0" Manufacturer="Microsoft IT" UpgradeCode="{BF388820-5266-41AF-BFFE-DC183C37D624}"> | ||
| 5 | <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> | ||
| 6 | <Media Id="1" Cabinet="WebServicePlugins1.cab" EmbedCab="yes" /> | ||
| 7 | |||
| 8 | <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> | ||
| 9 | |||
| 10 | <Feature Id="ProductFeature" Title="Web Test Plugin for Web Service Messages" Level="1"> | ||
| 11 | <ComponentRef Id="WebTestMessageEditor" /> | ||
| 12 | <ComponentRef Id="WebTestResultTab" /> | ||
| 13 | <ComponentRef Id="WebTestRuntime" /> | ||
| 14 | </Feature> | ||
| 15 | |||
| 16 | <Property Id="VS2012INSTALLFOLDER" Secure="yes"> | ||
| 17 | <RegistrySearch Id="VS2012InstallationFolderRegistrySearchId" Type="raw" | ||
| 18 | Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\11.0" Name="InstallDir"></RegistrySearch> | ||
| 19 | </Property> | ||
| 20 | |||
| 21 | <Condition Message="Visual Studio 2012 not found."> | ||
| 22 | Installed OR VS2012INSTALLFOLDER | ||
| 23 | </Condition> | ||
| 24 | </Product> | ||
| 25 | |||
| 26 | <Fragment> | ||
| 27 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
| 28 | <Directory Id="VS2012INSTALLFOLDER"> | ||
| 29 | <Directory Id="PrivateAssemblies" Name="PrivateAssemblies"> | ||
| 30 | <Directory Id="WebTestPlugins" Name="WebTestPlugins"> | ||
| 31 | <Component Id="WebTestMessageEditor" Guid="{17E95CD2-6B83-46C9-AEE5-019853FF62EC}"> | ||
| 32 | <File Source="$(var.WebServicePluginForWebTestMessageEditor.TargetPath)" Vital="yes" DiskId="1"/> | ||
| 33 | </Component> | ||
| 34 | </Directory> | ||
| 35 | </Directory> | ||
| 36 | <Directory Id="PublicAssemblies" Name="PublicAssemblies"> | ||
| 37 | <Component Id="WebTestRuntime" Guid="{854C9BA4-3E3E-4D0A-9DB1-DFF8140E834C}"> | ||
| 38 | <File Source="$(var.WebServicePluginForWebTestRuntime.TargetPath)" Vital="yes" DiskId="1"/> | ||
| 39 | </Component> | ||
| 40 | </Directory> | ||
| 41 | </Directory> | ||
| 42 | |||
| 43 | <Directory Id="AppDataFolder"> | ||
| 44 | <Directory Id="MSAppDataDir" Name="Microsoft"> | ||
| 45 | <Directory Id="VSAppDataDir" Name="VisualStudio"> | ||
| 46 | <Directory Id="VSAppDataVersionDir" Name="11.0"> | ||
| 47 | <Directory Id="VSAddins" Name="Addins"> | ||
| 48 | <Component Id="WebTestResultTab" Guid="{27569640-6946-4E4F-8E55-109E99A79DB9}"> | ||
| 49 | <RegistryValue KeyPath="yes" Root="HKCU" Key="SOFTWARE\Microsoft\WebServicePlugin" Name="Installed" Type="integer" Value="1" Action="write" /> | ||
| 50 | <File Source="$(var.WebServicePluginForWebTestResultTab.TargetPath)" Vital="yes" DiskId="1"/> | ||
| 51 | <File Source="$(var.WebServicePluginForWebTestResultTab.ProjectDir)WebServicePluginForWebTestResultTab.Addin" Vital="yes" DiskId="1"/> | ||
| 52 | <RemoveFolder Id="RemoveMSAppDataDir" Directory="MSAppDataDir" On="uninstall"/> | ||
| 53 | <RemoveFolder Id="RemoveVSAppDataDir" Directory="VSAppDataDir" On="uninstall"/> | ||
| 54 | <RemoveFolder Id="RemoveVSAppDataVersionDir" Directory="VSAppDataVersionDir" On="uninstall"/> | ||
| 55 | <RemoveFolder Id="RemoveVSAddins" Directory="VSAddins" On="uninstall"/> | ||
| 56 | </Component> | ||
| 57 | </Directory> | ||
| 58 | </Directory> | ||
| 59 | </Directory> | ||
| 60 | </Directory> | ||
| 61 | </Directory> | ||
| 62 | </Directory> | ||
| 63 | </Fragment> | ||
| 64 | </Wix> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
WebTestWebServiceSetup/ReadMe.txt
0 → 100644
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| 3 | <PropertyGroup> | ||
| 4 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| 5 | <Platform Condition=" '$(Platform)' == '' ">x86</Platform> | ||
| 6 | <ProductVersion>3.6</ProductVersion> | ||
| 7 | <ProjectGuid>73accda5-47c1-40c9-b63e-aff657e046e4</ProjectGuid> | ||
| 8 | <SchemaVersion>2.0</SchemaVersion> | ||
| 9 | <OutputName>Setup</OutputName> | ||
| 10 | <OutputType>Package</OutputType> | ||
| 11 | <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> | ||
| 12 | <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> | ||
| 13 | <Name>WebServicePluginsSetup</Name> | ||
| 14 | <SccProjectName>SAK</SccProjectName> | ||
| 15 | <SccLocalPath>SAK</SccLocalPath> | ||
| 16 | <SccAuxPath>SAK</SccAuxPath> | ||
| 17 | <SccProvider>SAK</SccProvider> | ||
| 18 | </PropertyGroup> | ||
| 19 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> | ||
| 20 | <OutputPath>bin\$(Configuration)\</OutputPath> | ||
| 21 | <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> | ||
| 22 | <DefineConstants>Debug</DefineConstants> | ||
| 23 | </PropertyGroup> | ||
| 24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | ||
| 25 | <OutputPath>bin\$(Configuration)\</OutputPath> | ||
| 26 | <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> | ||
| 27 | </PropertyGroup> | ||
| 28 | <ItemGroup> | ||
| 29 | <Compile Include="Product.wxs" /> | ||
| 30 | </ItemGroup> | ||
| 31 | <ItemGroup> | ||
| 32 | <ProjectReference Include="..\WebTestWebServiceMessageEditor\WebServicePluginForWebTestMessageEditor.csproj"> | ||
| 33 | <Name>WebServicePluginForWebTestMessageEditor</Name> | ||
| 34 | <Project>{23707a49-589b-4a36-bdaa-2896e647d07d}</Project> | ||
| 35 | <Private>True</Private> | ||
| 36 | <DoNotHarvest>True</DoNotHarvest> | ||
| 37 | <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> | ||
| 38 | <RefTargetDir>INSTALLFOLDER</RefTargetDir> | ||
| 39 | </ProjectReference> | ||
| 40 | <ProjectReference Include="..\WebTestWebServiceResultAddin\WebServicePluginForWebTestResultTab.csproj"> | ||
| 41 | <Name>WebServicePluginForWebTestResultTab</Name> | ||
| 42 | <Project>{48b3509e-1fd8-4875-8fc6-137647eb83aa}</Project> | ||
| 43 | <Private>True</Private> | ||
| 44 | <DoNotHarvest>True</DoNotHarvest> | ||
| 45 | <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> | ||
| 46 | <RefTargetDir>INSTALLFOLDER</RefTargetDir> | ||
| 47 | </ProjectReference> | ||
| 48 | <ProjectReference Include="..\WebTestWebServiceRuntime\WebServicePluginForWebTestRuntime.csproj"> | ||
| 49 | <Name>WebServicePluginForWebTestRuntime</Name> | ||
| 50 | <Project>{f9e36cfa-a657-4dd4-bd17-ba3d91eb469f}</Project> | ||
| 51 | <Private>True</Private> | ||
| 52 | <DoNotHarvest>True</DoNotHarvest> | ||
| 53 | <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> | ||
| 54 | <RefTargetDir>INSTALLFOLDER</RefTargetDir> | ||
| 55 | </ProjectReference> | ||
| 56 | </ItemGroup> | ||
| 57 | <Import Project="$(WixTargetsPath)" /> | ||
| 58 | <!-- | ||
| 59 | To modify your build process, add your task inside one of the targets below and uncomment it. | ||
| 60 | Other similar extension points exist, see Wix.targets. | ||
| 61 | <Target Name="BeforeBuild"> | ||
| 62 | </Target> | ||
| 63 | <Target Name="AfterBuild"> | ||
| 64 | </Target> | ||
| 65 | --> | ||
| 66 | </Project> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment