public async Task GetIterationByGuidTest() { List <Workspace> workspaces = CreateWorkspaces(); _workspaceRepo.Setup(repo => repo.GetWorkspaces()).ReturnsAsync(workspaces); // The setup for workspaces contains a release with two iterations, find one of the guids to do the lookup var releases = workspaces.Where(x => x.Releases != null).SelectMany(x => x.Releases); var releaseWithManyIterations = releases.Where(x => x.Iterations != null && x.Iterations.Count > 1).First(); // Grab the first iteration and get the guid var singleIteration = releaseWithManyIterations.Iterations.First(); var returnedIteration = await _service.GetIterationByGuid(singleIteration.Guid); Assert.NotNull(returnedIteration); Assert.IsType <Iteration>(returnedIteration); Assert.Equal(singleIteration, returnedIteration); }