public async Task Get_settings() { // Arrange var expected = new Settings(); var connector = Mock.Of<IWorkspacesConnector>() .ThatGetsJson("/acme/workspaces/cool/settings", expected); var client = new ExtendedWorkspacesClient(connector); // Act var response = await client.GetSettingsAsync("acme", "cool", null, None); // Assert response.ShouldBe(expected); }
public async Task Get_apps() { // Arrange var expected = new List<App>(); var connector = Mock.Of<IWorkspacesConnector>() .ThatGetsJson<IReadOnlyList<App>>("/acme/workspaces/cool/apps", expected); var client = new ExtendedWorkspacesClient(connector); // Act var response = await client.GetAppsAsync("acme", "cool", null, None); // Assert response.ShouldBe(expected); }
public async Task Get_apps_with_sandbox() { // Arrange var expected = new List<App>(); var expectedHeaders = new NameValueCollection { {"x-vtex-sandbox", "oscorp/tests=foo+bar"} }; var connector = Mock.Of<IWorkspacesConnector>() .ThatGetsJson<IReadOnlyList<App>>("/acme/workspaces/cool/apps", expectedHeaders, expected); var client = new ExtendedWorkspacesClient(connector); var sandboxes = new SandboxCollection(new[] { new Sandbox("oscorp", "tests", new[] {"foo", "bar"}) }); // Act var response = await client.GetAppsAsync("acme", "cool", sandboxes, None); // Assert response.ShouldBe(expected); }
public async Task Get_active_sandboxes() { // Arrange var expected = new SandboxCollection(new[] { new Sandbox(null, "joao", new[] {"vanilla", "choco"}), new Sandbox(null, "maria", new[] {"icecream", "brownie"}) }); var connector = Mock.Of<IWorkspacesConnector>() .ThatGetsJson("/acme/workspaces/cool/sandboxes", expected); var client = new ExtendedWorkspacesClient(connector); // Act var response = await client.GetActiveSandboxesAsync("acme", "cool", None); // Assert response.ShouldBe(expected); }