using Microsoft.AspNetCore.Mvc.Testing; using Xunit.Abstractions; using XUnitDIStudy.Model; namespace XUnitDIStudy.IntegrationTest { public class BasicTest:IDisposable,IClassFixture> { private readonly ITestOutputHelper _output; private readonly WebApplicationFactory _factory; public BasicTest(ITestOutputHelper outputHelper,WebApplicationFactory factory) { _output = outputHelper; _factory = factory; } [Fact,Custom] public async void Client_Test() { var httpClient = _factory.CreateClient(); var respone = await httpClient.GetAsync("Default/GetAll"); respone.EnsureSuccessStatusCode(); var students = await respone.Content.ReadFromJsonAsync>(); Assert.NotNull(students); Assert.NotEmpty(students); Assert.True(students.Count>0); } public void Dispose() { } } }