Exemple #1
0
        public void GetManifest_NullProduct_ThrowsException()
        {
            IFileSystem fileSystem = Substitute.For <IFileSystem>();

            this.sut = new JsonFileProductManifestRepository(fileSystem);

            Assert.Throws <ArgumentException>(() => this.sut.GetManifest(null, "someVersion"));
        }
Exemple #2
0
        public void GetManifest_InvalidJson_ThrowsException()
        {
            IFileSystem fileSystem = Substitute.For <IFileSystem>();

            fileSystem.OpenRead(Arg.Any <string>()).Returns(GetInvalidStream());

            this.sut = new JsonFileProductManifestRepository(fileSystem);

            Assert.Throws <JsonSerializationException>(() => this.sut.GetManifest("someProduct", "someVersion"));
        }
Exemple #3
0
        public void GetManifest_ManyVersions_GetsCorrectVersion()
        {
            IFileSystem fileSystem = Substitute.For <IFileSystem>();

            fileSystem.OpenRead(Arg.Any <string>()).Returns(GetValidStreamManyVersions());

            this.sut = new JsonFileProductManifestRepository(fileSystem);
            ProductManifest result = this.sut.GetManifest("otherProduct", "1.1.0");

            Assert.NotNull(result);
        }
Exemple #4
0
        public void GetManifest_VersionNotFound_ReturnsNull()
        {
            IFileSystem fileSystem = Substitute.For <IFileSystem>();

            fileSystem.OpenRead(Arg.Any <string>()).Returns(GetValidStream());

            this.sut = new JsonFileProductManifestRepository(fileSystem);
            ProductManifest result = this.sut.GetManifest("someProduct", "1.999.0");

            Assert.Null(result);
        }
Exemple #5
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);
        }
Exemple #6
0
 public void Ctor_NullFileSystem_ThrowsException()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           this.sut = new JsonFileProductManifestRepository(null));
 }