public void ListRepositories_FromUserAdminTeamAfterHavingCreateOneRepoInside_ShouldReturnAtLeastTheCreatedOne()
        {
            teamsEndPoint.ShouldNotBe(null);
            var team = teamsEndPoint.GetUserTeamsWithAdminRole()[0];

            var repositoryName = Guid.NewGuid().ToString("N");
            var teamRepository = new Repository
            {
                name     = repositoryName,
                language = "c#",
                scm      = "git"
            };
            var teamResource     = new TeamsEndPoint(TestHelpers.SharpBucketV2, team.username);
            var teamRepoResource = SampleRepositories.RepositoriesEndPoint.RepositoryResource(team.username, repositoryName);

            teamRepoResource.PostRepository(teamRepository);

            try
            {
                var repositories = teamResource.ListRepositories();
                repositories.ShouldNotBeEmpty();
                repositories.Any(r => r.name == teamRepository.name).ShouldBe(true);
            }
            finally
            {
                teamRepoResource.DeleteRepository();
            }
        }
        public void Init()
        {
            sharpBucket   = TestHelpers.SharpBucketV2;
            teamsEndPoint = sharpBucket.TeamsEndPoint();

            teamName     = teamsEndPoint.GetUserTeamsWithAdminRole()[0].username;
            teamResource = teamsEndPoint.TeamResource(teamName);
        }
Exemple #3
0
        public void EnumerateSearchCodeSearchResults_SearchStringWordFromTeamAtlassianWithPageLenLessThanTheNumberOfEnumeratedResults_RequestsCountShouldIncrementLazily()
        {
            ISharpBucketRequesterV2 realSharpBucketRequesterV2 = TestHelpers.SharpBucketV2;
            var sharpBucketRequesterV2Mock = new Mock <ISharpBucketRequesterV2>();
            Expression <Func <ISharpBucketRequesterV2, IteratorBasedPage <SearchCodeSearchResult> > > sendMethod
                = x => x.Send <IteratorBasedPage <SearchCodeSearchResult> >(It.IsAny <HttpMethod>(), It.IsAny <object>(), It.IsAny <string>(), It.IsAny <object>());

            sharpBucketRequesterV2Mock
            .Setup(sendMethod)
            .Returns <HttpMethod, object, string, object>((m, b, u, p) => realSharpBucketRequesterV2.Send <IteratorBasedPage <SearchCodeSearchResult> >(m, b, u, p));
            var teamsEndPointIntercepted = new TeamsEndPoint(sharpBucketRequesterV2Mock.Object);

            var searchResults = teamsEndPointIntercepted.TeamResource("atlassian").EnumerateSearchCodeSearchResults("string", 5);

            sharpBucketRequesterV2Mock.Verify(
                sendMethod,
                Times.Never(),
                "Building the enumerable should not produce any request");

            var i = 0;

            foreach (var _ in searchResults)
            {
                if (i < 5)
                {
                    sharpBucketRequesterV2Mock.Verify(
                        sendMethod,
                        Times.Exactly(1),
                        "Only first page should have been called");
                }
                else
                {
                    sharpBucketRequesterV2Mock.Verify(
                        sendMethod,
                        Times.Exactly(2),
                        "Only two pages should have been called");
                    if (i == 9)
                    {
                        break;
                    }
                }

                i++;
            }
        }
 public void Init()
 {
     sharpBucket   = TestHelpers.SharpBucketV2;
     teamsEndPoint = sharpBucket.TeamsEndPoint();
 }
Exemple #5
0
 public void Init()
 {
     sharpBucket   = TestHelpers.GetV2ClientAuthenticatedWithOAuth();
     teamsEndPoint = sharpBucket.TeamsEndPoint(TEAM_NAME);
 }