Commit 334c2535 authored by Scott DePouw's avatar Scott DePouw

Make client references private readonly.

parent 6a754a74
...@@ -12,17 +12,17 @@ namespace CleanArchitecture.Tests.Integration.Web ...@@ -12,17 +12,17 @@ namespace CleanArchitecture.Tests.Integration.Web
public class ApiToDoItemsControllerList : IClassFixture<CustomWebApplicationFactory<Startup>> public class ApiToDoItemsControllerList : IClassFixture<CustomWebApplicationFactory<Startup>>
{ {
public HttpClient Client { get; } private readonly HttpClient _client;
public ApiToDoItemsControllerList(CustomWebApplicationFactory<Startup> factory) public ApiToDoItemsControllerList(CustomWebApplicationFactory<Startup> factory)
{ {
Client = factory.CreateClient(); _client = factory.CreateClient();
} }
[Fact] [Fact]
public async Task ReturnsTwoItems() public async Task ReturnsTwoItems()
{ {
var response = await Client.GetAsync("/api/todoitems"); var response = await _client.GetAsync("/api/todoitems");
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
var stringResponse = await response.Content.ReadAsStringAsync(); var stringResponse = await response.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject<IEnumerable<ToDoItem>>(stringResponse).ToList(); var result = JsonConvert.DeserializeObject<IEnumerable<ToDoItem>>(stringResponse).ToList();
......
...@@ -7,17 +7,17 @@ namespace CleanArchitecture.Tests.Integration.Web ...@@ -7,17 +7,17 @@ namespace CleanArchitecture.Tests.Integration.Web
{ {
public class HomeControllerIndexShould : IClassFixture<CustomWebApplicationFactory<Startup>> public class HomeControllerIndexShould : IClassFixture<CustomWebApplicationFactory<Startup>>
{ {
public HttpClient Client { get; } private readonly HttpClient _client;
public HomeControllerIndexShould(CustomWebApplicationFactory<Startup> factory) public HomeControllerIndexShould(CustomWebApplicationFactory<Startup> factory)
{ {
Client = factory.CreateClient(); _client = factory.CreateClient();
} }
[Fact] [Fact]
public async Task ReturnViewWithCorrectMessage() public async Task ReturnViewWithCorrectMessage()
{ {
HttpResponseMessage response = await Client.GetAsync("/"); HttpResponseMessage response = await _client.GetAsync("/");
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
string stringResponse = await response.Content.ReadAsStringAsync(); string stringResponse = await response.Content.ReadAsStringAsync();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment