public async Task Get_by_id_throws_a_HttpRequestExecption_when_response_status_code_is_500() { var httpClient = DataFactories.HttpClientFactory.CreateHttpClient(HttpStatusCode.InternalServerError, null); var todoClient = new TypecodeTodoClient(httpClient); var actual = await todoClient.Get(1); }
public async Task Get_returns_a_valid_list_of_todos() { var todoList = DataFactories.TodosFactory.CreateTodoList(5); var httpClient = DataFactories.HttpClientFactory.CreateHttpClient(HttpStatusCode.OK, todoList); var todoClient = new TypecodeTodoClient(httpClient); var actual = await todoClient.Get(); Assert.AreEqual(todoList.Count, actual.Count); }
public async Task Get_by_id_returns_a_valid_todo() { var todo = DataFactories.TodosFactory.CreateTodo( DataFactories.TodosFactory.CreateId(), DataFactories.TodosFactory.CreateId(), DataFactories.TodosFactory.CreateRandomLorem(5), true ); var httpClient = DataFactories.HttpClientFactory.CreateHttpClient(HttpStatusCode.OK, todo); var todoClient = new TypecodeTodoClient(httpClient); var actual = await todoClient.Get(todo.Id); Assert.IsNotNull(actual); Assert.AreEqual(todo.Id, actual.Id); Assert.AreEqual(todo.UserId, actual.UserId); Assert.AreEqual(todo.Title, actual.Title); Assert.AreEqual(todo.Completed, actual.Completed); }