public async Task Get_manifest()
        {
            // Arrange
            var expected = new App("acme", "vanilla", "1.2.3");
            var connector = Mock.Of<IGalleryConnector>()
                .ThatGetsJson("/acme/sandboxes/john/vanilla/1.2.3", expected);
            var client = new SandboxesClient(connector);

            // Act
            var result = await client.GetManifestAsync("acme", "john", "vanilla", "1.2.3", None);

            // Assert
            result.ShouldBe(expected);
        }
 private async Task<AppFile> GetFileFromArchiveAsync(App app, string path, CancellationToken cancellationToken)
 {
     try
     {
         var archive = await this.GetArchiveAsync(app.Id, app.Version, cancellationToken).ConfigureAwait(false);
         return archive.GetFile(path).WithApp(app.Id);
     }
     catch (ResourceNotFoundException e)
     {
         var sandboxName = this.SandboxFor(app.Id);
         throw sandboxName == null
             ? e.WithApp(app.Id, app.Version, path)
             : e.WithSandbox(app.Vendor, sandboxName, app.Id.ToString(), path);
     }
 }
示例#3
0
        public void App()
        {
            // Arrange
            var expected = new App("acme", "vanilla", "1.2.3", "Cool App", "The coolest app",
                new Dictionary<AppIdentifier, string> {{"acme.choco", "4.5.6"}},
                new List<string> {"storefront", "iam"});
            var json = JsonConvert.SerializeObject(expected);

            // Act
            var app = JsonConvert.DeserializeObject<App>(json);

            // Assert
            app.Id.ShouldBe("acme.vanilla");
            app.Vendor.ShouldBe("acme");
            app.Name.ShouldBe("vanilla");
            app.Version.ShouldBe("1.2.3");
            app.Dependencies.ShouldBe(new Dictionary<AppIdentifier, string> {{"acme.choco", "4.5.6"}});
            app.Services.ShouldBe(new List<string> { "storefront", "iam" });
        }