public async Task GetPostTypeTest() { using (HttpClient client = _testServer.CreateClient()) { HttpResponseMessage response = await client.GetAsync(_apiEndpoint + "api/PostType/"); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); List <PostTypeDto> content = await response.Content.ReadAsAsync <List <PostTypeDto> >(); Assert.AreEqual(MockDBContextInitializer.InitialPostTypes().Length, content.Count); } }
public async Task CheckAuthenticatedUserAccessOfAuthenticateEndpointTest() { User user = MockDBContextInitializer.InitialUsers()[0]; HttpClient client = _testServer.CreateClient(user.UserId); HttpResponseMessage response = await client.GetAsync(_apiEndpoint + "api/user"); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); UserDto content = await response.Content.ReadAsAsync <UserDto>(); Assert.AreEqual(user.FirstName, content.FirstName); Assert.AreEqual(user.LastName, content.LastName); }