Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
 public void Ctor_NullFileSystem_ThrowsException()
 {
     Assert.Throws <ArgumentNullException>(() =>
                                           this.sut = new JsonFileProductManifestRepository(null));
 }