public async void GetIconsByTermAsyncReturnsNothingWhenNotFound() { // Arrange Mock <RestSharp.IRestClient> clientMock = new Mock <RestSharp.IRestClient>(); clientMock.Setup(c => c.ExecuteTaskAsync(It.Is <RestSharp.IRestRequest>(req => req.Resource == "icons/{term}"))).Returns(() => Task.FromResult(RestUtils.GetNotFoundResponse())); INounProjectService target = new NounProjectService(clientMock.Object, new Internal.RequestBuilder()); // Act var result = await target.GetIconsAsync("fun"); // Assert Assert.Null(result); }
public async void GetCollectionIconsByIdAsyncReturnsCollection() { // Arrange Mock <RestSharp.IRestClient> clientMock = new Mock <RestSharp.IRestClient>(); clientMock.Setup(c => c.ExecuteTaskAsync(It.Is <RestSharp.IRestRequest>(req => req.Resource == "collection/{id}/icons"))).Returns(() => Task.FromResult(RestUtils.GetOkResponse(ResponseResource.ResourceManager.GetString("collection_id_icons")))); INounProjectService target = new NounProjectService(clientMock.Object, new Internal.RequestBuilder()); // Act var result = await target.GetCollectionIconsAsync(4); // Assert Assert.NotNull(result); // TODO: Add more checks }
public async void GetUserUploadsAsyncReturnsIcons() { // Arrange Mock <RestSharp.IRestClient> clientMock = new Mock <RestSharp.IRestClient>(); clientMock.Setup(c => c.ExecuteTaskAsync(It.Is <RestSharp.IRestRequest>(req => req.Resource == "user/{username}/uploads"))).Returns(() => Task.FromResult(RestUtils.GetOkResponse(ResponseResource.ResourceManager.GetString("user_uploads")))); INounProjectService target = new NounProjectService(clientMock.Object, new Internal.RequestBuilder()); // Act var result = await target.GetUserUploadsAsync("john"); // Assert Assert.NotNull(result); // TODO: Add more checks }