public static IExtendedWorkspacesClient ThatGetsFileList(this IExtendedWorkspacesClient @this, string account, string workspace, FileListingOptions options, FileList fileList) { Mock.Get(@this).Setup(x => x.ListFilesAsync(account, workspace, It.Is<FileListingOptions>(arg => arg.Equals(options)), It.IsAny<CancellationToken>())) .ReturnsAsync(fileList); return @this; }
public static IAppsClient ThatGetsFileList(this IAppsClient @this, AppIdentifier app, string version, FileListingOptions options, FileList fileList) { Mock.Get(@this).Setup(x => x.ListFilesAsync(app, version, It.Is<FileListingOptions>(arg => arg.Equals(options)), It.IsAny<CancellationToken>())) .ReturnsAsync(fileList); return @this; }
public async Task Return_from_sandbox() { // Arrange var expected = new FileList(new Dictionary<string, FileListItem>()); var options = new FileListingOptions(new[] { "a/" }, new[] { "b" }, true); var appsClient = Mock.Of<IAppsClient>().ThatGetsFileList("acme.vanilla", "1.2.3", options, expected); var sandboxesClient = Mock.Of<ISandboxesClient>(); var connector = new TestableAppsContextConnector(appsClient, sandboxesClient, null, "a", new[] {"b"}); // Act var archive = await connector.GetArchiveAsync("acme.vanilla", "1.2.3"); // Assert archive.ShouldBeSameAs(expected); connector.CachedArchives["acme.vanilla"].ShouldBeSameAs(expected); }