增加工程:增加单元测试

This commit is contained in:
Argo-MacBookPro 2018-11-02 17:35:42 +08:00
parent e3011a0296
commit 64f02c469a
3 changed files with 49 additions and 0 deletions

View File

@ -60,6 +60,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MySQL", "MySQL", "{084E2E94
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bootstrap.DataAccess.MySQL", "Bootstrap.DataAccess.MySQL\Bootstrap.DataAccess.MySQL.csproj", "{B6877AEA-EC65-47DA-BA6E-FD657729C285}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{F301A509-31AE-45EA-9453-CA8C0A73DE99}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -94,6 +96,10 @@ Global
{B6877AEA-EC65-47DA-BA6E-FD657729C285}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6877AEA-EC65-47DA-BA6E-FD657729C285}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6877AEA-EC65-47DA-BA6E-FD657729C285}.Release|Any CPU.Build.0 = Release|Any CPU
{F301A509-31AE-45EA-9453-CA8C0A73DE99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F301A509-31AE-45EA-9453-CA8C0A73DE99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F301A509-31AE-45EA-9453-CA8C0A73DE99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F301A509-31AE-45EA-9453-CA8C0A73DE99}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

24
UnitTest/UnitTest.csproj Normal file
View File

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Bootstrap.Admin\Startup.cs" Link="Startup.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.5" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.1.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

19
UnitTest/UnitTest1.cs Normal file
View File

@ -0,0 +1,19 @@
using Bootstrap.Admin;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Xunit;
namespace UnitTest
{
public class UnitTest1
{
[Fact]
public void Test1()
{
var server = new TestServer(WebHost.CreateDefaultBuilder()
.UseStartup<Startup>());
}
}
}