Beispiel #1
0
 //[Test]
 public void BitbucketService_GetPrivateCommits()
 {
     var service = new BitbucketService(new ProviderConfigurationElement {
         Owner = "secret", UserName = "******", Password = "******"
     });
     string json = service.GetCommits("secret", "master");
 }
Beispiel #2
0
 public void BitbucketService_GetPublicCommits()
 {
     var service = new BitbucketService(new ProviderConfigurationElement {
         Owner = "stanbpublic"
     });
     string json = service.GetCommits("testrepo", "master");
 }
        private static IGitProvider GetProvider(ProviderType providerType)
        {
            var loaderConfigurationSection = (ConfigurationManager.GetSection("LoaderConfiguration") as LoaderConfigurationSection);

            if (loaderConfigurationSection == null)
            {
                throw new ApplicationException("LoaderConfiguration section is missing");
            }
            var providerConfig = loaderConfigurationSection.Providers.Where(w => w.Type == providerType).FirstOrDefault();

            if (providerConfig == null)
            {
                throw new ApplicationException(string.Format("{0} provider configuration is missing", providerType));
            }
            IGitProvider provider;

            if (providerType == ProviderType.Github)
            {
                var githubService = new GithubService(providerConfig);
                provider = new GithubProvider(githubService);
            }
            else
            {
                var bitbucketService = new BitbucketService(providerConfig);
                provider = new BitbucketProvider(bitbucketService);
            }

            return(provider);
        }
        public static Branch InitializeBranch(this StoreItem item, BitbucketService bitbucketService)
        {
            var branches = bitbucketService._client.Branches.GetByCommitId(
                item.Project.Key,
                item.Repository.Slug,
                item.Commit.Id,
                bitbucketService._requestOptions).Result.Values;

            return(branches.Single());
        }
        public void BitBucketService_InitializeStore_AllBranches()
        {
            var username     = "";
            var password     = "";
            var bitbucketUrl = "";

            // arrange
            var bitbucketService = new BitbucketService();

            bitbucketService.Connect(bitbucketUrl, username, password);

            // act
            bitbucketService.InitializeStore();

            var orderByDescending = bitbucketService.Store.Where(x => x.Project.Key == "SE").OrderByDescending(x => x.Commit.AuthorTimestamp);
            var storeCount        = bitbucketService.Store.Count;

            // assert
            // TODO (ROK):
        }
Beispiel #6
0
 public static T Resolve <T>(params object[] ctorParams)
 {
     if (typeof(T) == typeof(ICodebaseService))
     {
         if (_codebaseService == null)
         {
             var instance = new BitbucketService((string)ctorParams[0]);
             //var instance = new CodebaseServiceStub();
             _codebaseService = instance;
             return((T)_codebaseService);
         }
         else
         {
             throw new NotImplementedException();
         }
     }
     else
     {
         throw new NotImplementedException();
     }
 }