public async Task <IEnumerable <ItemGroupDto> > GetGroupsAsync(bool includeTasks = false) { await AuthoriseAsync(_client, _authenticationService); var response = await _client.GetAsync <IEnumerable <ItemGroupDto> >(GroupUrls.GetGroupsUrl(includeTasks)); return(await _proxyHelper.ProcessResponseAsync(response, this)); }
public async Task GetGroupsAsync_Always_HandlesResult(bool includeTasks) { //Arrange var sut = CreateSut(); var response = new Mock <IHttpResponse <IEnumerable <ItemGroupDto> > >(); Mocker.GetMock <IHttpClient>() .Setup(o => o.GetAsync <IEnumerable <ItemGroupDto> >(GroupUrls.GetGroupsUrl(includeTasks))) .ReturnsAsync(response.Object); var groupDto = new ItemGroupDto(Guid.NewGuid(), "", "", "", new List <TaskDto>()); Mocker.GetMock <IProxyHelper>() .Setup(o => o.ProcessResponseAsync(response.Object, sut)) .ReturnsAsync(new[] { groupDto }); //Act var result = await sut.GetGroupsAsync(includeTasks); //Assert result.Count().ShouldBe(1); }