添加VS项目
parent
be910108d9
commit
4522cb70b3
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:7344/",
|
||||||
|
"sslPort": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "api/values",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Study.WebApi": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "api/values",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"applicationUrl": "http://localhost:7345/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="wwwroot\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.8" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"AppConfiguration": {
|
||||||
|
"MainWindow": {
|
||||||
|
"Height": "400",
|
||||||
|
"Width": "600",
|
||||||
|
"Top": "0",
|
||||||
|
"Left": "0"
|
||||||
|
},
|
||||||
|
"ConnectionString":"Server=(localdb)\\\\mssqllocaldb;Database=DatabaseName;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Study.XUnitTest
|
||||||
|
{
|
||||||
|
public class ConfigrationTest
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Test1()
|
||||||
|
{
|
||||||
|
CustomProviderStudy sudyProvider=new CustomProviderStudy();
|
||||||
|
var customConfiguration= sudyProvider.BuildConfigurationFromInMemoryCollection();
|
||||||
|
|
||||||
|
Assert.Equal(Environment.UserName, customConfiguration["Profile:UserName"]);
|
||||||
|
Assert.Equal("love", customConfiguration["Profile:UserName"]);
|
||||||
|
|
||||||
|
Assert.Equal(400, customConfiguration.GetValue<int>("AppConfiguration:MainWindow:Height"));
|
||||||
|
Assert.Equal(600, customConfiguration.GetValue<int>("AppConfiguration:MainWindow:Width"));
|
||||||
|
Assert.Equal(0, customConfiguration.GetValue<int>("AppConfiguration:MainWindow:Top"));
|
||||||
|
Assert.Equal(0, customConfiguration.GetValue<int>("AppConfiguration:MainWindow:Left"));
|
||||||
|
Assert.Contains("localdb", customConfiguration.GetValue<string>("AppConfiguration:ConnectionString"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AppJsonTest()
|
||||||
|
{
|
||||||
|
CustomProviderStudy sudyProvider = new CustomProviderStudy();
|
||||||
|
var appJsonConfiguration = sudyProvider.BuildProviderFromAppJson();
|
||||||
|
|
||||||
|
Assert.NotNull(appJsonConfiguration);
|
||||||
|
|
||||||
|
//Assert.True(appJsonConfiguration.GetSection("club") != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void BuildJsonTest()
|
||||||
|
{
|
||||||
|
CustomProviderStudy customProvider=new CustomProviderStudy();
|
||||||
|
var cc = customProvider.BuildProviderFromJson();
|
||||||
|
var dd= cc.GetChildren();
|
||||||
|
|
||||||
|
Assert.NotNull(cc);
|
||||||
|
Assert.NotNull(dd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="2.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Xml" Version="2.0.2" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
|
||||||
|
<PackageReference Include="xunit" Version="2.3.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||||
|
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Study.WebApi\Study.WebApi.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="App.config">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="App.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Reference in New Issue