public async Task RemoveUserById_NoToken_Unauthorized() { // Arrange var userToRemove = MockApplicationUsers.Get(4); var path = $"{Routes.UserRoute}/{userToRemove.Id}"; // Act var response = await _endSystems.Delete(path); // Assert Assert.Equal(HttpStatusCode.Unauthorized, response.Code); // Tear down _endSystems.Dispose(); }
public async Task Create_UserDoesNotExistAnymote_Unauthorized() { // Arrange var user = MockApplicationUsers.Get(5); var admin = MockApplicationUsers.Get(0); var userToken = await GetToken(user); var adminToken = await GetToken(admin); var deletePath = $"{Routes.UserRoute}/{user.Id}"; const string createPath = Routes.TodoRoute; _endSystems.SetBearerToken(adminToken); var deleteResponse = await _endSystems.Delete(deletePath); Assert.Equal(HttpStatusCode.NoContent, deleteResponse.Code); _endSystems.RemoveBearerToken(); _endSystems.SetBearerToken(userToken); var model = new CreateTodoViewModel { Description = "They paved paradise and put up a parking lot", Due = new DateTime(2000, 1, 1) }; var body = JsonStringBuilder.CreateTodoJsonBody(model.Description, model.Due.ToString()); var content = new StringContent(body); // Act var response = await _endSystems.Post(createPath, content); // Assert Assert.Equal(HttpStatusCode.Unauthorized, response.Code); // Tear down _endSystems.Dispose(); }