예제 #1
0
            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());
            }
예제 #2
0
            async Task Add()
            {
                SetTestPath();
                var repo   = mockup.Get <IGitRepoRepository>();
                var result = await repo.Add(GitRepoTests.CreateInput("TestRepo"));

                Assert.NotNull(result);
            }
예제 #3
0
            async Task Add()
            {
                SetTestPath();
                var controller = mockup.Get <GitReposController>();

                var result = await controller.Add(GitRepoTests.CreateInput("TestRepo"));

                Assert.NotNull(result);
            }
예제 #4
0
            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);
            }
예제 #5
0
            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);
            }
예제 #6
0
            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);
            }
예제 #7
0
            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);
            }
예제 #8
0
            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);
            }