浏览代码

添加单元测试. & 原CCID输入!

张泳健 8 年前
父节点
当前提交
364835cd4c

+ 4 - 0
.gitignore 查看文件

37
 GWSocketClient/obj/Release/GWSocketClient.IdItemEditor.resources
37
 GWSocketClient/obj/Release/GWSocketClient.IdItemEditor.resources
38
 GWSocketClient/obj/Debug/GWSocketClient.AnaProtocol.resources
38
 GWSocketClient/obj/Debug/GWSocketClient.AnaProtocol.resources
39
 GWSocketClient/obj/Release/GWSocketClient.AnaProtocol.resources
39
 GWSocketClient/obj/Release/GWSocketClient.AnaProtocol.resources
40
+GWSocketClientTests/bin
41
+GWSocketClientTests/obj
42
+packages/
43
+TestResults/

+ 7 - 1
GWSocketClient.sln 查看文件

1
 
1
 
2
 Microsoft Visual Studio Solution File, Format Version 12.00
2
 Microsoft Visual Studio Solution File, Format Version 12.00
3
 # Visual Studio 15
3
 # Visual Studio 15
4
-VisualStudioVersion = 15.0.26430.6
4
+VisualStudioVersion = 15.0.26430.15
5
 MinimumVisualStudioVersion = 10.0.40219.1
5
 MinimumVisualStudioVersion = 10.0.40219.1
6
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GWSocketClient", "GWSocketClient\GWSocketClient.csproj", "{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}"
6
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GWSocketClient", "GWSocketClient\GWSocketClient.csproj", "{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}"
7
 EndProject
7
 EndProject
8
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GWSocketClientTests", "GWSocketClientTests\GWSocketClientTests.csproj", "{8D9E3AB8-D1FE-41F6-93CF-3ACC7616163D}"
9
+EndProject
8
 Global
10
 Global
9
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
11
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
10
 		Debug|Any CPU = Debug|Any CPU
12
 		Debug|Any CPU = Debug|Any CPU
15
 		{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}.Debug|Any CPU.Build.0 = Debug|Any CPU
17
 		{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}.Debug|Any CPU.Build.0 = Debug|Any CPU
16
 		{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}.Release|Any CPU.ActiveCfg = Release|Any CPU
18
 		{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}.Release|Any CPU.ActiveCfg = Release|Any CPU
17
 		{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}.Release|Any CPU.Build.0 = Release|Any CPU
19
 		{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}.Release|Any CPU.Build.0 = Release|Any CPU
20
+		{8D9E3AB8-D1FE-41F6-93CF-3ACC7616163D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21
+		{8D9E3AB8-D1FE-41F6-93CF-3ACC7616163D}.Debug|Any CPU.Build.0 = Debug|Any CPU
22
+		{8D9E3AB8-D1FE-41F6-93CF-3ACC7616163D}.Release|Any CPU.ActiveCfg = Release|Any CPU
23
+		{8D9E3AB8-D1FE-41F6-93CF-3ACC7616163D}.Release|Any CPU.Build.0 = Release|Any CPU
18
 	EndGlobalSection
24
 	EndGlobalSection
19
 	GlobalSection(SolutionProperties) = preSolution
25
 	GlobalSection(SolutionProperties) = preSolution
20
 		HideSolutionNode = FALSE
26
 		HideSolutionNode = FALSE

+ 16 - 15
GWSocketClient/Form1.Designer.cs 查看文件

38
             this.label6 = new System.Windows.Forms.Label();
38
             this.label6 = new System.Windows.Forms.Label();
39
             this.tfTmpSendData = new System.Windows.Forms.TextBox();
39
             this.tfTmpSendData = new System.Windows.Forms.TextBox();
40
             this.tbCCID = new System.Windows.Forms.TextBox();
40
             this.tbCCID = new System.Windows.Forms.TextBox();
41
-            this.label5 = new System.Windows.Forms.Label();
42
             this.btnPressureTest = new System.Windows.Forms.Button();
41
             this.btnPressureTest = new System.Windows.Forms.Button();
43
             this.label4 = new System.Windows.Forms.Label();
42
             this.label4 = new System.Windows.Forms.Label();
44
             this.tbPresureTestCount = new System.Windows.Forms.TextBox();
43
             this.tbPresureTestCount = new System.Windows.Forms.TextBox();
74
             this.rightMenuCopyCmd = new System.Windows.Forms.ToolStripMenuItem();
73
             this.rightMenuCopyCmd = new System.Windows.Forms.ToolStripMenuItem();
75
             this.rightMenuClearInfo = new System.Windows.Forms.ToolStripMenuItem();
74
             this.rightMenuClearInfo = new System.Windows.Forms.ToolStripMenuItem();
76
             this.timerHeartBeat = new System.Windows.Forms.Timer(this.components);
75
             this.timerHeartBeat = new System.Windows.Forms.Timer(this.components);
76
+            this.cbCCIDIsSource = new System.Windows.Forms.CheckBox();
77
             this.groupBox1.SuspendLayout();
77
             this.groupBox1.SuspendLayout();
78
             this.menuStrip1.SuspendLayout();
78
             this.menuStrip1.SuspendLayout();
79
             this.statusStrip1.SuspendLayout();
79
             this.statusStrip1.SuspendLayout();
85
             // 
85
             // 
86
             this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
86
             this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
87
             | System.Windows.Forms.AnchorStyles.Right)));
87
             | System.Windows.Forms.AnchorStyles.Right)));
88
+            this.groupBox1.Controls.Add(this.cbCCIDIsSource);
88
             this.groupBox1.Controls.Add(this.btnTextCmd);
89
             this.groupBox1.Controls.Add(this.btnTextCmd);
89
             this.groupBox1.Controls.Add(this.buttonCmdManager);
90
             this.groupBox1.Controls.Add(this.buttonCmdManager);
90
             this.groupBox1.Controls.Add(this.label7);
91
             this.groupBox1.Controls.Add(this.label7);
92
             this.groupBox1.Controls.Add(this.label6);
93
             this.groupBox1.Controls.Add(this.label6);
93
             this.groupBox1.Controls.Add(this.tfTmpSendData);
94
             this.groupBox1.Controls.Add(this.tfTmpSendData);
94
             this.groupBox1.Controls.Add(this.tbCCID);
95
             this.groupBox1.Controls.Add(this.tbCCID);
95
-            this.groupBox1.Controls.Add(this.label5);
96
             this.groupBox1.Controls.Add(this.btnPressureTest);
96
             this.groupBox1.Controls.Add(this.btnPressureTest);
97
             this.groupBox1.Controls.Add(this.label4);
97
             this.groupBox1.Controls.Add(this.label4);
98
             this.groupBox1.Controls.Add(this.tbPresureTestCount);
98
             this.groupBox1.Controls.Add(this.tbPresureTestCount);
175
             this.tbCCID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
175
             this.tbCCID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
176
             | System.Windows.Forms.AnchorStyles.Right)));
176
             | System.Windows.Forms.AnchorStyles.Right)));
177
             this.tbCCID.ForeColor = System.Drawing.Color.Blue;
177
             this.tbCCID.ForeColor = System.Drawing.Color.Blue;
178
-            this.tbCCID.Location = new System.Drawing.Point(701, 21);
178
+            this.tbCCID.Location = new System.Drawing.Point(713, 21);
179
             this.tbCCID.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
179
             this.tbCCID.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
180
             this.tbCCID.Name = "tbCCID";
180
             this.tbCCID.Name = "tbCCID";
181
-            this.tbCCID.Size = new System.Drawing.Size(414, 23);
181
+            this.tbCCID.Size = new System.Drawing.Size(402, 23);
182
             this.tbCCID.TabIndex = 12;
182
             this.tbCCID.TabIndex = 12;
183
             this.tbCCID.Text = "3839383630324231313931353530343739383737";
183
             this.tbCCID.Text = "3839383630324231313931353530343739383737";
184
             this.tbCCID.TextChanged += new System.EventHandler(this.tbCCID_TextChanged);
184
             this.tbCCID.TextChanged += new System.EventHandler(this.tbCCID_TextChanged);
185
             // 
185
             // 
186
-            // label5
187
-            // 
188
-            this.label5.AutoSize = true;
189
-            this.label5.Location = new System.Drawing.Point(650, 24);
190
-            this.label5.Name = "label5";
191
-            this.label5.Size = new System.Drawing.Size(45, 17);
192
-            this.label5.TabIndex = 11;
193
-            this.label5.Text = "CCCID";
194
-            // 
195
             // btnPressureTest
186
             // btnPressureTest
196
             // 
187
             // 
197
             this.btnPressureTest.Location = new System.Drawing.Point(329, 61);
188
             this.btnPressureTest.Location = new System.Drawing.Point(329, 61);
266
             this.tbEquipmentAddress.Location = new System.Drawing.Point(462, 21);
257
             this.tbEquipmentAddress.Location = new System.Drawing.Point(462, 21);
267
             this.tbEquipmentAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
258
             this.tbEquipmentAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
268
             this.tbEquipmentAddress.Name = "tbEquipmentAddress";
259
             this.tbEquipmentAddress.Name = "tbEquipmentAddress";
269
-            this.tbEquipmentAddress.Size = new System.Drawing.Size(182, 23);
260
+            this.tbEquipmentAddress.Size = new System.Drawing.Size(157, 23);
270
             this.tbEquipmentAddress.TabIndex = 5;
261
             this.tbEquipmentAddress.TabIndex = 5;
271
             this.tbEquipmentAddress.Text = "4442832E833D";
262
             this.tbEquipmentAddress.Text = "4442832E833D";
272
             this.tbEquipmentAddress.TextChanged += new System.EventHandler(this.tbEquipmentAddress_TextChanged);
263
             this.tbEquipmentAddress.TextChanged += new System.EventHandler(this.tbEquipmentAddress_TextChanged);
512
             this.timerHeartBeat.Interval = 1000;
503
             this.timerHeartBeat.Interval = 1000;
513
             this.timerHeartBeat.Tick += new System.EventHandler(this.timerHeartBeat_Tick);
504
             this.timerHeartBeat.Tick += new System.EventHandler(this.timerHeartBeat_Tick);
514
             // 
505
             // 
506
+            // cbCCIDIsSource
507
+            // 
508
+            this.cbCCIDIsSource.AutoSize = true;
509
+            this.cbCCIDIsSource.Location = new System.Drawing.Point(625, 23);
510
+            this.cbCCIDIsSource.Name = "cbCCIDIsSource";
511
+            this.cbCCIDIsSource.Size = new System.Drawing.Size(82, 21);
512
+            this.cbCCIDIsSource.TabIndex = 19;
513
+            this.cbCCIDIsSource.Text = "CCID ? 源";
514
+            this.cbCCIDIsSource.UseVisualStyleBackColor = true;
515
+            // 
515
             // Form1
516
             // Form1
516
             // 
517
             // 
517
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
518
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
563
         private System.Windows.Forms.Button btnQuickLogout;
564
         private System.Windows.Forms.Button btnQuickLogout;
564
         private System.Windows.Forms.Button btnLogin;
565
         private System.Windows.Forms.Button btnLogin;
565
         private System.Windows.Forms.TextBox tbCCID;
566
         private System.Windows.Forms.TextBox tbCCID;
566
-        private System.Windows.Forms.Label label5;
567
         private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
567
         private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
568
         private System.Windows.Forms.ToolStripStatusLabel tsslCCIDLEN;
568
         private System.Windows.Forms.ToolStripStatusLabel tsslCCIDLEN;
569
         private System.Windows.Forms.GroupBox groupBox2;
569
         private System.Windows.Forms.GroupBox groupBox2;
588
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemLogHb;
588
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemLogHb;
589
         private System.Windows.Forms.Timer timerHeartBeat;
589
         private System.Windows.Forms.Timer timerHeartBeat;
590
         private System.Windows.Forms.ToolStripMenuItem StripMenuItemLoSucHb;
590
         private System.Windows.Forms.ToolStripMenuItem StripMenuItemLoSucHb;
591
+        private System.Windows.Forms.CheckBox cbCCIDIsSource;
591
     }
592
     }
592
 }
593
 }
593
 
594
 

+ 18 - 6
GWSocketClient/Form1.cs 查看文件

326
 
326
 
327
                 if (ToolStripMenuItemLogHb.Checked && hbLen.Equals("0000"))
327
                 if (ToolStripMenuItemLogHb.Checked && hbLen.Equals("0000"))
328
                 {
328
                 {
329
-                    addToListboxItem(string.Format("收到服务端{0}发来心跳:[{1}]", sks.Ip, reqData));
329
+                    addToListboxItem(string.Format("收到服务端{0}发来心跳funCode={2}:[{1}]", sks.Ip, reqData,reqData.Substring(18,2)));
330
                 }
330
                 }
331
             }
331
             }
332
             else
332
             else
333
             {
333
             {
334
-                addToListboxItem(string.Format("收到服务端{0}发来消息:[{1}]", sks.Ip, reqData));
334
+                addToListboxItem(string.Format("收到服务端{0}发来消息,funCode={2}:[{1}]", sks.Ip, reqData,reqData.Substring(18,2)));
335
             }
335
             }
336
 
336
 
337
             if (!(funcode == 16 || funcode == 32))
337
             if (!(funcode == 16 || funcode == 32))
437
         {
437
         {
438
             //                string loginCmd = "7e7e7e4442832e833c8200143839383630324231313931353530343739383737f7";
438
             //                string loginCmd = "7e7e7e4442832e833c8200143839383630324231313931353530343739383737f7";
439
             string loginCmd = vcarecityProtocolBean.ProtocolStartSymbol;
439
             string loginCmd = vcarecityProtocolBean.ProtocolStartSymbol;
440
-            loginCmd += tbEquipmentAddress.Text.Trim() + "82" +
441
-                        Utils.stringWith0(Utils.tenToHex(tbCCID.Text.Trim().Length / 2), 4);
442
-            loginCmd += tbCCID.Text.Trim();
440
+            loginCmd += tbEquipmentAddress.Text.Trim() + "82";
441
+                        
442
+
443
+            if(cbCCIDIsSource.Checked)
444
+            {
445
+                loginCmd += Utils.stringWith0(Utils.tenToHex(tbCCID.Text.Trim().Length ), 4);
446
+                loginCmd += Utils.transateCCID(tbCCID.Text.Trim());
447
+            }
448
+            else
449
+            {
450
+                loginCmd += Utils.stringWith0(Utils.tenToHex(tbCCID.Text.Trim().Length / 2), 4);
451
+                loginCmd += tbCCID.Text.Trim();
452
+            }
453
+
454
+            
443
             loginCmd = Utils.calcCrcCode(loginCmd);
455
             loginCmd = Utils.calcCrcCode(loginCmd);
444
             //发送登录命令
456
             //发送登录命令
445
             byte[] ts = HexUtil.hexToBytes(loginCmd);
457
             byte[] ts = HexUtil.hexToBytes(loginCmd);
446
 
458
 
447
-            addToListboxItem(string.Format("发送到服务端:[{0}]", loginCmd));
459
+            addToListboxItem(string.Format("发送到服务端,funCode={0} : [{1}]", loginCmd.Substring(18, 2), loginCmd));
448
 
460
 
449
             sockeTcpClients.SendData(ts);
461
             sockeTcpClients.SendData(ts);
450
         }
462
         }

+ 1 - 1
GWSocketClient/GWSocketClient.csproj 查看文件

5
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
     <ProjectGuid>{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}</ProjectGuid>
7
     <ProjectGuid>{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}</ProjectGuid>
8
-    <OutputType>Exe</OutputType>
8
+    <OutputType>WinExe</OutputType>
9
     <RootNamespace>GWSocketClient</RootNamespace>
9
     <RootNamespace>GWSocketClient</RootNamespace>
10
     <AssemblyName>GWSocketClient</AssemblyName>
10
     <AssemblyName>GWSocketClient</AssemblyName>
11
     <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
11
     <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>

二进制
GWSocketClient/bin/Release/dbfile/ID_INFO.accdb 查看文件


+ 16 - 1
GWSocketClient/util/Utils.cs 查看文件

7
 
7
 
8
 namespace GWSocketClient.util
8
 namespace GWSocketClient.util
9
 {
9
 {
10
-    class Utils
10
+    public class Utils
11
     {
11
     {
12
         public static int hexToTen(string hex)
12
         public static int hexToTen(string hex)
13
         {
13
         {
129
             }
129
             }
130
             return stringWith0(tenToHex(result), 2);
130
             return stringWith0(tenToHex(result), 2);
131
         }
131
         }
132
+
133
+        public static string transateCCID(string source)
134
+        {
135
+            string res = "";
136
+            for(int i=0;i< source.Length; i++)
137
+            {
138
+                int hex = Int32.Parse(source[i].ToString(), NumberStyles.HexNumber);
139
+                int ten = hexToTen(hex + "")+30;
140
+
141
+                res += ten + "";
142
+               // Console.WriteLine(ten);
143
+            }
144
+            return res;
145
+        }
146
+
132
     }
147
     }
133
 }
148
 }

+ 106 - 0
GWSocketClientTests/GWSocketClientTests.csproj 查看文件

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProjectGuid>{8D9E3AB8-D1FE-41F6-93CF-3ACC7616163D}</ProjectGuid>
8
+    <OutputType>Library</OutputType>
9
+    <AppDesignerFolder>Properties</AppDesignerFolder>
10
+    <RootNamespace>GWSocketClientTests</RootNamespace>
11
+    <AssemblyName>GWSocketClientTests</AssemblyName>
12
+    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
13
+    <FileAlignment>512</FileAlignment>
14
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
15
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
16
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
17
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
18
+    <IsCodedUITest>False</IsCodedUITest>
19
+    <TestProjectType>UnitTest</TestProjectType>
20
+    <TargetFrameworkProfile />
21
+    <NuGetPackageImportStamp>
22
+    </NuGetPackageImportStamp>
23
+  </PropertyGroup>
24
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25
+    <DebugSymbols>true</DebugSymbols>
26
+    <DebugType>full</DebugType>
27
+    <Optimize>false</Optimize>
28
+    <OutputPath>bin\Debug\</OutputPath>
29
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
30
+    <ErrorReport>prompt</ErrorReport>
31
+    <WarningLevel>4</WarningLevel>
32
+  </PropertyGroup>
33
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
34
+    <DebugType>pdbonly</DebugType>
35
+    <Optimize>true</Optimize>
36
+    <OutputPath>bin\Release\</OutputPath>
37
+    <DefineConstants>TRACE</DefineConstants>
38
+    <ErrorReport>prompt</ErrorReport>
39
+    <WarningLevel>4</WarningLevel>
40
+  </PropertyGroup>
41
+  <ItemGroup>
42
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
43
+      <HintPath>..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
44
+    </Reference>
45
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
46
+      <HintPath>..\packages\MSTest.TestFramework.1.1.11\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
47
+    </Reference>
48
+    <Reference Include="System" />
49
+  </ItemGroup>
50
+  <Choose>
51
+    <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
52
+      <ItemGroup>
53
+        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
54
+      </ItemGroup>
55
+    </When>
56
+    <Otherwise />
57
+  </Choose>
58
+  <ItemGroup>
59
+    <Compile Include="Properties\AssemblyInfo.cs" />
60
+    <Compile Include="util\UtilsTests.cs" />
61
+  </ItemGroup>
62
+  <ItemGroup>
63
+    <None Include="packages.config" />
64
+  </ItemGroup>
65
+  <ItemGroup>
66
+    <ProjectReference Include="..\GWSocketClient\GWSocketClient.csproj">
67
+      <Project>{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}</Project>
68
+      <Name>GWSocketClient</Name>
69
+    </ProjectReference>
70
+  </ItemGroup>
71
+  <Choose>
72
+    <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
73
+      <ItemGroup>
74
+        <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
75
+          <Private>False</Private>
76
+        </Reference>
77
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
78
+          <Private>False</Private>
79
+        </Reference>
80
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
81
+          <Private>False</Private>
82
+        </Reference>
83
+        <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
84
+          <Private>False</Private>
85
+        </Reference>
86
+      </ItemGroup>
87
+    </When>
88
+  </Choose>
89
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
90
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
91
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
92
+    <PropertyGroup>
93
+      <ErrorText>此项目引用这台计算机上缺少的 NuGet 程序包。使用 NuGet 程序包还原可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
94
+    </PropertyGroup>
95
+    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.props'))" />
96
+    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets'))" />
97
+  </Target>
98
+  <Import Project="..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.11\build\net45\MSTest.TestAdapter.targets')" />
99
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
100
+       Other similar extension points exist, see Microsoft.Common.targets.
101
+  <Target Name="BeforeBuild">
102
+  </Target>
103
+  <Target Name="AfterBuild">
104
+  </Target>
105
+  -->
106
+</Project>

+ 36 - 0
GWSocketClientTests/Properties/AssemblyInfo.cs 查看文件

1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// 有关程序集的一般信息由以下
6
+// 控制。更改这些特性值可修改
7
+// 与程序集关联的信息。
8
+[assembly: AssemblyTitle("GWSocketClientTests")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("GWSocketClientTests")]
13
+[assembly: AssemblyCopyright("Copyright ©  2017")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+//将 ComVisible 设置为 false 将使此程序集中的类型
18
+//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
19
+//请将此类型的 ComVisible 特性设置为 true。
20
+[assembly: ComVisible(false)]
21
+
22
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23
+[assembly: Guid("8d9e3ab8-d1fe-41f6-93cf-3acc7616163d")]
24
+
25
+// 程序集的版本信息由下列四个值组成: 
26
+//
27
+//      主版本
28
+//      次版本
29
+//      生成号
30
+//      修订号
31
+//
32
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
33
+// 方法是按如下所示使用“*”: :
34
+// [assembly: AssemblyVersion("1.0.*")]
35
+[assembly: AssemblyVersion("1.0.0.0")]
36
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 5 - 0
GWSocketClientTests/packages.config 查看文件

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<packages>
3
+  <package id="MSTest.TestAdapter" version="1.1.11" targetFramework="net452" />
4
+  <package id="MSTest.TestFramework" version="1.1.11" targetFramework="net452" />
5
+</packages>

+ 24 - 0
GWSocketClientTests/util/UtilsTests.cs 查看文件

1
+using Microsoft.VisualStudio.TestTools.UnitTesting;
2
+using GWSocketClient.util;
3
+using System;
4
+using System.Collections.Generic;
5
+using System.Linq;
6
+using System.Text;
7
+using System.Threading.Tasks;
8
+
9
+namespace GWSocketClient.util.Tests
10
+{
11
+    [TestClass()]
12
+    public class UtilsTests
13
+    {
14
+        [TestMethod()]
15
+        public void transateCCIDTest()
16
+        {
17
+
18
+            string abc = Utils.transateCCID("898602B1191550339913");
19
+            Console.WriteLine(abc);
20
+            Console.WriteLine("3839383630324231313931353530333339393133");
21
+
22
+        }
23
+    }
24
+}