public async Task GetUserRepositories_ShouldCallCorrectUrlAndGetResult() { var responseJson = Utilities.LoadFile(Paths.GetStandardDataPath("GetUserRepositoriesResponse.json")); var responseData = new NewtonsoftJsonSerializer().Deserialize <List <RepositoryV1> >(responseJson); var response = MockRepository.GenerateMock <IRestResponse <List <RepositoryV1> > >(); response.Stub(x => x.Data).Return(responseData); var result = _versionOneClient .Capture() .Args <IRestRequest, IRestResponse <List <RepositoryV1> > >((s, req) => s.ExecuteTaskAsync <List <RepositoryV1> >(req), response); var resultData = (await _sut.GetUserRepositories()).ToList(); Assert.AreEqual(1, result.CallCount); var args = result.Args[0]; Assert.Multiple(() => { Assert.AreEqual("user/repositories", args.Resource); Assert.AreEqual(Method.GET, args.Method); var firstRepo = resultData[0]; Assert.AreEqual("teamrepo", firstRepo.Name); Assert.IsNull(firstRepo.Id); Assert.AreEqual("git", firstRepo.Scm); Assert.AreEqual("2016-07-30 11:48:44+00:00", firstRepo.CreatedOn); Assert.AreEqual("2017-03-25 10:41:23+00:00", firstRepo.UpdatedOn); Assert.AreEqual("teamrepo", firstRepo.Name); Assert.AreEqual(true, firstRepo.IsPrivate); Assert.AreEqual("http://[email protected]/testujemyext/teamrepo.git", firstRepo.Links.Clone.First().Href); }); }