You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
725 B
C#
37 lines
725 B
C#
7 years ago
|
using System;
|
||
|
|
||
|
using Microsoft.AspNetCore.TestHost;
|
||
|
|
||
|
using Xunit;
|
||
|
|
||
|
using WebApiStudy.IntegrationTest;
|
||
|
using System.Net;
|
||
|
|
||
|
namespace ConfigureStudy.WebAppTest
|
||
|
{
|
||
|
[Collection(name:"GlobalTestServer")]
|
||
|
public class TestDemo:IDisposable
|
||
|
{
|
||
|
private TestServer testServer;
|
||
|
|
||
|
public TestDemo(TestServerFixture testServer)
|
||
|
{
|
||
|
this.testServer = testServer.TestServer;
|
||
|
}
|
||
|
|
||
|
[Fact]
|
||
|
public void Test()
|
||
|
{
|
||
|
var client = testServer.CreateClient();
|
||
|
var apiResponse= client.GetAsync("/api/values").Result;
|
||
|
|
||
|
Assert.True(apiResponse.StatusCode==HttpStatusCode.OK);
|
||
|
}
|
||
|
|
||
|
public void Dispose()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|