示例#1
0
        private static IDeploymentService BuildService()
        {
            VstsConfig  vstsConfig = GetVstsConfig();
            IFileSystem fileSystem = new FileSystem();
            IHttpClient httpClient = new HttpClient();
            IProductManifestRepository manifestRepository = new JsonFileProductManifestRepository(fileSystem);
            ITokenRepository           tokenRepository    = new JsonFileTokenRepository(fileSystem);
            IVstsReleaseClient         releaseClient      = new VstsSyncReleaseClient(vstsConfig);
            IAuthenticator             authenticator      = new VstsOAuthAuthenticator(httpClient, tokenRepository, vstsConfig);
            IReleaseRepository         releaseRepository  = new VstsReleaseRepository(releaseClient, authenticator, vstsConfig);
            IServiceDeploymentExecutor deploymentExecutor = new VstsDeploymentExecutor(releaseRepository, vstsConfig);
            IServiceDeploymentHandler  deploymentHandler  = new SequentialDeploymentHandler(deploymentExecutor, 10);
            IDeploymentService         service            = new DeploymentService(manifestRepository, deploymentHandler);

            return(service);
        }
示例#2
0
        public void GetReleaseId__Succeeds()
        {
            VstsConfig         vstsConfig      = GetVstsConfig();
            IVstsReleaseClient releaseClient   = new VstsSyncReleaseClient(vstsConfig);
            IHttpClient        httpClient      = new HttpClient();
            ITokenRepository   tokenRepository =
                new JsonFileTokenRepository(new FileSystem());
            IAuthenticator authenticator =
                new VstsOAuthAuthenticator(httpClient, tokenRepository, vstsConfig);

            File.Copy($"..//..//..//testdata//{TokenFilename}", fullTokenFilename, true);

            this.sut = new VstsReleaseRepository(releaseClient, authenticator, vstsConfig);

            string result = this.sut.GetReleaseId("samplepackage", "1.1.11");

            File.Copy(fullTokenFilename, $"..//..//..//testdata//{TokenFilename}", true);

            Assert.NotNull(result);
        }