Pārlūkot izejas kodu

1.单元测试库改用nunit,方便跨平台
2.linux上用nunit-console4成功跑通TNetTest测试

tanghai 11 gadi atpakaļ
vecāks
revīzija
2c835f0770

+ 14 - 0
CSharp-Mono/CSharp-Mono.sln

@@ -15,6 +15,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TNet", "Platform\TNet\TNet.
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UNet", "Platform\UNet\UNet.csproj", "{3A56E389-BB11-421C-9E11-EA88C5CA3EFC}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TNetTest", "Platform\TNetTest\TNetTest.csproj", "{27CDF1D7-723A-4BD9-BA7E-39CB479DCA85}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UNetTest", "Platform\UNetTest\UNetTest.csproj", "{E4DD0EC7-FAC5-459A-8496-E5B4F828C9BD}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -25,6 +29,10 @@ Global
 		{01895B6C-E8E9-4F14-9497-E9DB426ADB11}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{01895B6C-E8E9-4F14-9497-E9DB426ADB11}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{01895B6C-E8E9-4F14-9497-E9DB426ADB11}.Release|Any CPU.Build.0 = Release|Any CPU
+		{27CDF1D7-723A-4BD9-BA7E-39CB479DCA85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{27CDF1D7-723A-4BD9-BA7E-39CB479DCA85}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{27CDF1D7-723A-4BD9-BA7E-39CB479DCA85}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{27CDF1D7-723A-4BD9-BA7E-39CB479DCA85}.Release|Any CPU.Build.0 = Release|Any CPU
 		{3A56E389-BB11-421C-9E11-EA88C5CA3EFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{3A56E389-BB11-421C-9E11-EA88C5CA3EFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{3A56E389-BB11-421C-9E11-EA88C5CA3EFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -37,6 +45,10 @@ Global
 		{AA3FD3AA-1835-42F4-9BE3-4A26D7CA8AB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{AA3FD3AA-1835-42F4-9BE3-4A26D7CA8AB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{AA3FD3AA-1835-42F4-9BE3-4A26D7CA8AB1}.Release|Any CPU.Build.0 = Release|Any CPU
+		{E4DD0EC7-FAC5-459A-8496-E5B4F828C9BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E4DD0EC7-FAC5-459A-8496-E5B4F828C9BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E4DD0EC7-FAC5-459A-8496-E5B4F828C9BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E4DD0EC7-FAC5-459A-8496-E5B4F828C9BD}.Release|Any CPU.Build.0 = Release|Any CPU
 		{EF4373AF-66D4-4313-A882-60EF0AE4239A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{EF4373AF-66D4-4313-A882-60EF0AE4239A}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{EF4373AF-66D4-4313-A882-60EF0AE4239A}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -48,6 +60,8 @@ Global
 		{EF4373AF-66D4-4313-A882-60EF0AE4239A} = {3B94631D-6166-4733-922D-8D7ED69510F2}
 		{AA3FD3AA-1835-42F4-9BE3-4A26D7CA8AB1} = {3B94631D-6166-4733-922D-8D7ED69510F2}
 		{3A56E389-BB11-421C-9E11-EA88C5CA3EFC} = {3B94631D-6166-4733-922D-8D7ED69510F2}
+		{27CDF1D7-723A-4BD9-BA7E-39CB479DCA85} = {3B94631D-6166-4733-922D-8D7ED69510F2}
+		{E4DD0EC7-FAC5-459A-8496-E5B4F828C9BD} = {3B94631D-6166-4733-922D-8D7ED69510F2}
 	EndGlobalSection
 	GlobalSection(MonoDevelopProperties) = preSolution
 		outputpath = Bin

+ 2 - 5
CSharp-Mono/CSharp-Mono.userprefs

@@ -1,11 +1,8 @@
 <Properties StartupItem="Platform\Common\Common.csproj">
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="d:\Source\Egametang\CSharp\Game\Model\Component\NetworkComponent.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="d:\Source\Egametang\CSharp\Platform\TNetTest\TcpListenerTest.cs">
     <Files>
-      <File FileName="d:\Source\Egametang\CSharp\Platform\Common\Helper\BigIntegerHelper.cs" Line="27" Column="27" />
-      <File FileName="d:\Source\Egametang\CSharp\Platform\Common\Helper\XmlHelper.cs" Line="15" Column="15" />
-      <File FileName="d:\Source\Egametang\CSharp\Platform\TNet\TChannel.cs" Line="8" Column="8" />
-      <File FileName="d:\Source\Egametang\CSharp\Game\Model\Component\NetworkComponent.cs" Line="7" Column="7" />
+      <File FileName="d:\Source\Egametang\CSharp\Platform\TNetTest\TcpListenerTest.cs" Line="4" Column="4" />
     </Files>
   </MonoDevelop.Ide.Workbench>
   <MonoDevelop.Ide.DebuggingService.Breakpoints>

+ 27 - 0
CSharp-Mono/Platform/TNetTest/Properties/AssemblyInfo.cs

@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle ("TNetTest")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("")]
+[assembly: AssemblyCopyright ("tanghai")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion ("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+

+ 56 - 0
CSharp-Mono/Platform/TNetTest/TNetTest.csproj

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{27CDF1D7-723A-4BD9-BA7E-39CB479DCA85}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>TNetTest</RootNamespace>
+    <AssemblyName>TNetTest</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\Bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>full</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\Bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="nunit.framework">
+      <HintPath>..\..\..\CSharp\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="..\..\..\CSharp\Platform\TNetTest\TcpListenerTest.cs">
+      <Link>TcpListenerTest.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\CSharp\Platform\TNetTest\TServiceTest.cs">
+      <Link>TServiceTest.cs</Link>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <ItemGroup>
+    <ProjectReference Include="..\TNet\TNet.csproj">
+      <Project>{AA3FD3AA-1835-42F4-9BE3-4A26D7CA8AB1}</Project>
+      <Name>TNet</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\Common\Common.csproj">
+      <Project>{EF4373AF-66D4-4313-A882-60EF0AE4239A}</Project>
+      <Name>Common</Name>
+    </ProjectReference>
+  </ItemGroup>
+</Project>

+ 27 - 0
CSharp-Mono/Platform/UNetTest/Properties/AssemblyInfo.cs

@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle ("UNetTest")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("")]
+[assembly: AssemblyCopyright ("tanghai")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion ("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+

+ 53 - 0
CSharp-Mono/Platform/UNetTest/UNetTest.csproj

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{E4DD0EC7-FAC5-459A-8496-E5B4F828C9BD}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>UNetTest</RootNamespace>
+    <AssemblyName>UNetTest</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\Bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>full</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\..\Bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="nunit.framework">
+      <HintPath>..\..\..\CSharp\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="..\..\..\CSharp\Platform\UNetTest\UServiceTest.cs">
+      <Link>UServiceTest.cs</Link>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <ItemGroup>
+    <ProjectReference Include="..\Common\Common.csproj">
+      <Project>{EF4373AF-66D4-4313-A882-60EF0AE4239A}</Project>
+      <Name>Common</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\UNet\UNet.csproj">
+      <Project>{3A56E389-BB11-421C-9E11-EA88C5CA3EFC}</Project>
+      <Name>UNet</Name>
+    </ProjectReference>
+  </ItemGroup>
+</Project>

+ 16 - 5
CSharp/Platform/TNetTest/TNetTest.csproj

@@ -17,6 +17,8 @@
     <IsCodedUITest>False</IsCodedUITest>
     <TestProjectType>UnitTest</TestProjectType>
     <TargetFrameworkProfile />
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <RestorePackages>true</RestorePackages>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -36,6 +38,9 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="nunit.framework">
+      <HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
   </ItemGroup>
   <Choose>
@@ -44,11 +49,7 @@
         <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
       </ItemGroup>
     </When>
-    <Otherwise>
-      <ItemGroup>
-        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
-      </ItemGroup>
-    </Otherwise>
+    <Otherwise />
   </Choose>
   <ItemGroup>
     <Compile Include="TcpListenerTest.cs" />
@@ -67,6 +68,9 @@
   <ItemGroup>
     <Folder Include="Properties\" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
   <Choose>
     <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
       <ItemGroup>
@@ -87,6 +91,13 @@
   </Choose>
   <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
+  </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">

+ 3 - 3
CSharp/Platform/TNetTest/TServiceTest.cs

@@ -2,13 +2,13 @@
 using System.Threading;
 using System.Threading.Tasks;
 using Common.Helper;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Common.Network;
+using NUnit.Framework;
 using TNet;
 
 namespace TNetTest
 {
-	[TestClass]
+	[TestFixture]
 	public class TServiceTest
 	{
 		private readonly Barrier barrier = new Barrier(3);
@@ -35,7 +35,7 @@ namespace TNetTest
 			this.barrier.RemoveParticipant();
 		}
 
-		[TestMethod]
+		[Test]
 		public void ClientSendToServer()
 		{
 			const string hostName = "127.0.0.1";

+ 9 - 9
CSharp/Platform/TNetTest/TcpListenerTest.cs

@@ -4,11 +4,11 @@ using System.Net.Sockets;
 using System.Threading;
 using Common.Helper;
 using Common.Logger;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+using NUnit.Framework;
 
 namespace TNetTest
 {
-	[TestClass]
+	[TestFixture]
 	public class TcpListenerTest
 	{
 		private const ushort port = 11111;
@@ -16,17 +16,17 @@ namespace TNetTest
 		private readonly Barrier barrier = new Barrier(2);
 		private readonly object lockObject = new object();
 
-		[TestMethod]
+		[Test]
 		public void AcceptAsync()
 		{
-			var thread1 = new Thread(this.Server);
+			Thread thread1 = new Thread(this.Server);
 			thread1.Start();
 
 			Thread.Sleep(2);
 
 			for (int i = 0; i < 1; ++i)
 			{
-				var thread = new Thread(this.Client);
+				Thread thread = new Thread(this.Client);
 				thread.Start();
 			}
 			this.barrier.SignalAndWait();
@@ -34,7 +34,7 @@ namespace TNetTest
 
 		private async void Client()
 		{
-			using (var tcpClient = new TcpClient(AddressFamily.InterNetwork))
+			using (TcpClient tcpClient = new TcpClient(AddressFamily.InterNetwork))
 			{
 				await tcpClient.ConnectAsync("127.0.0.1", port);
 				using (NetworkStream ns = tcpClient.GetStream())
@@ -60,13 +60,13 @@ namespace TNetTest
 
 		private async void Server()
 		{
-			var tcpListener = new TcpListener(IPAddress.Parse("127.0.0.1"), port);
+			TcpListener tcpListener = new TcpListener(IPAddress.Parse("127.0.0.1"), port);
 			tcpListener.Start();
 
 			while (this.count != 1)
 			{
-				var socket = await tcpListener.AcceptSocketAsync();
-				var ns = new NetworkStream(socket);
+				Socket socket = await tcpListener.AcceptSocketAsync();
+				NetworkStream ns = new NetworkStream(socket);
 				this.Response(ns);
 			}
 		}

+ 4 - 0
CSharp/Platform/TNetTest/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="NUnit" version="2.6.4" targetFramework="net451" />
+</packages>

+ 16 - 5
CSharp/Platform/UNetTest/UNetTest.csproj

@@ -17,6 +17,8 @@
     <IsCodedUITest>False</IsCodedUITest>
     <TestProjectType>UnitTest</TestProjectType>
     <TargetFrameworkProfile />
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <RestorePackages>true</RestorePackages>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -38,6 +40,9 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="nunit.framework">
+      <HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="WindowsBase" />
   </ItemGroup>
@@ -47,11 +52,7 @@
         <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
       </ItemGroup>
     </When>
-    <Otherwise>
-      <ItemGroup>
-        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
-      </ItemGroup>
-    </Otherwise>
+    <Otherwise />
   </Choose>
   <ItemGroup>
     <Compile Include="UServiceTest.cs" />
@@ -73,6 +74,9 @@
   <ItemGroup>
     <Folder Include="Properties\" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
   <Choose>
     <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
       <ItemGroup>
@@ -93,6 +97,13 @@
   </Choose>
   <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
+  </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">

+ 3 - 3
CSharp/Platform/UNetTest/UServiceTest.cs

@@ -2,13 +2,13 @@
 using System.Threading;
 using System.Threading.Tasks;
 using Common.Helper;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
 using Common.Network;
+using NUnit.Framework;
 using UNet;
 
 namespace UNetTest
 {
-	[TestClass]
+	[TestFixture]
 	public class UServiceTest
 	{
 		private readonly Barrier barrier = new Barrier(3);
@@ -35,7 +35,7 @@ namespace UNetTest
 			this.barrier.RemoveParticipant();
 		}
 
-		[TestMethod]
+		[Test]
 		public void ClientSendToServer()
 		{
 			const string hostName = "127.0.0.1";

+ 4 - 0
CSharp/Platform/UNetTest/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="NUnit" version="2.6.4" targetFramework="net451" />
+</packages>