mirror of https://github.com/abpframework/abp
parent
1c6a45a175
commit
57d037def5
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>2c282467-2cd5-4750-be1f-ca8bd8ecc6ea</ProjectGuid>
|
||||
<RootNamespace>
|
||||
</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
@ -0,0 +1,35 @@
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Shouldly;
|
||||
using Volo.Abp.AspNetCore.TestBase;
|
||||
|
||||
namespace Volo.Abp.AspNetCore.App
|
||||
{
|
||||
public abstract class AppTestBase : AbpAspNetCoreIntegratedTestBase<Startup>
|
||||
{
|
||||
protected virtual async Task<T> GetResponseAsObjectAsync<T>(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK)
|
||||
{
|
||||
var strResponse = await GetResponseAsStringAsync(url, expectedStatusCode);
|
||||
return JsonConvert.DeserializeObject<T>(strResponse, new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||
});
|
||||
}
|
||||
|
||||
protected virtual async Task<string> GetResponseAsStringAsync(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK)
|
||||
{
|
||||
var response = await GetResponseAsync(url, expectedStatusCode);
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
protected virtual async Task<HttpResponseMessage> GetResponseAsync(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK)
|
||||
{
|
||||
var response = await Client.GetAsync(url);
|
||||
response.StatusCode.ShouldBe(expectedStatusCode);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue