public void GetManifest_NullProduct_ThrowsException() { IFileSystem fileSystem = Substitute.For <IFileSystem>(); this.sut = new JsonFileProductManifestRepository(fileSystem); Assert.Throws <ArgumentException>(() => this.sut.GetManifest(null, "someVersion")); }
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")); }
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); }
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); }
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); }
public void Ctor_NullFileSystem_ThrowsException() { Assert.Throws <ArgumentNullException>(() => this.sut = new JsonFileProductManifestRepository(null)); }