async Task HasGitRepos() { SetTestPath(); var repo = mockup.Get <IGitRepoRepository>(); await repo.AddRange(new GitRepoInput[] { GitRepoTests.CreateInput("TestRepo1"), GitRepoTests.CreateInput("TestRepo2"), GitRepoTests.CreateInput("TestRepo3") }); Assert.True(await repo.HasGitRepos()); }
async Task Add() { SetTestPath(); var repo = mockup.Get <IGitRepoRepository>(); var result = await repo.Add(GitRepoTests.CreateInput("TestRepo")); Assert.NotNull(result); }
async Task Add() { SetTestPath(); var controller = mockup.Get <GitReposController>(); var result = await controller.Add(GitRepoTests.CreateInput("TestRepo")); Assert.NotNull(result); }
async Task List() { SetTestPath(); //This could be more complete var repo = mockup.Get <IGitRepoRepository>(); await repo.AddRange(new GitRepoInput[] { GitRepoTests.CreateInput("TestRepo1"), GitRepoTests.CreateInput("TestRepo2"), GitRepoTests.CreateInput("TestRepo3") }); var query = new GitRepoQuery(); var result = await repo.List(query); Assert.Equal(query.Limit, result.Limit); Assert.Equal(query.Offset, result.Offset); Assert.Equal(3, result.Total); Assert.NotEmpty(result.Items); }
async Task Get() { SetTestPath(); var repo = mockup.Get <IGitRepoRepository>(); await repo.AddRange(new GitRepoInput[] { GitRepoTests.CreateInput("TestRepo1"), GitRepoTests.CreateInput("TestRepo2"), GitRepoTests.CreateInput("TestRepo3") }); var result = await repo.Add(GitRepoTests.CreateInput("TestRepoLookup")); var list = await repo.List(new GitRepoQuery() { Limit = int.MaxValue }); Assert.Equal <int>(4, list.Total); var getResult = await repo.Get(result.Name); Assert.NotNull(getResult); }
async Task Delete() { SetTestPath(); var controller = mockup.Get <GitReposController>(); var result = await controller.Add(GitRepoTests.CreateInput("TestRepo")); Assert.NotNull(result); var listResult = await controller.List(new GitRepoQuery()); Assert.Equal(1, listResult.Total); await controller.Delete(result.Name); listResult = await controller.List(new GitRepoQuery()); Assert.Equal(0, listResult.Total); }
async Task Get() { SetTestPath(); var totalItems = 3; var controller = mockup.Get <GitReposController>(); for (var i = 0; i < totalItems; ++i) { Assert.NotNull(await controller.Add(GitRepoTests.CreateInput($"Repo{i}"))); } //Manually add the item we will look back up var lookup = await controller.Add(GitRepoTests.CreateInput($"RepoLookup")); var result = await controller.Get(lookup.Name); Assert.NotNull(result); }
async Task List() { SetTestPath(); var totalItems = 3; var controller = mockup.Get <GitReposController>(); for (var i = 0; i < totalItems; ++i) { Assert.NotNull(await controller.Add(GitRepoTests.CreateInput($"Repo{i}"))); } var query = new GitRepoQuery(); var result = await controller.List(query); Assert.Equal(query.Limit, result.Limit); Assert.Equal(query.Offset, result.Offset); Assert.Equal(3, result.Total); Assert.NotEmpty(result.Items); }