public void ExportAsyncGateway(IAsyncCloudGateway asyncGateway) { var gatewayMetadata = new Dictionary<string, object>() { { nameof(CloudGatewayMetadata.CloudService), MOCKGATEWAY_NAME } }; CompositionInitializer.ConfigurationPreset = new ContainerConfiguration() .WithExport(asyncGateway, metadata: gatewayMetadata); }
public TestDirectory(IAsyncCloudGateway gateway, RootName root, string apiKey, string path) { this.gateway = gateway; this.root = root; var rootDirectory = gateway.GetRootAsync(root, apiKey).Result; directory = gateway.NewDirectoryItemAsync(root, rootDirectory.Id, path).Result; }
public void ExportAsyncGateway(IAsyncCloudGateway asyncGateway) { var gatewayMetadata = new Dictionary <string, object>() { { nameof(CloudGatewayMetadata.CloudService), MOCKGATEWAY_NAME } }; CompositionInitializer.ConfigurationPreset = new ContainerConfiguration() .WithExport(asyncGateway, metadata: gatewayMetadata); }
public bool TryGetAsyncCloudGatewayForSchema(string cloudService, out IAsyncCloudGateway asyncGateway) { var result = default(ExportFactory<IAsyncCloudGateway, CloudGatewayMetadata>); if (asyncGateways.TryGetValue(cloudService, out result)) { asyncGateway = result.CreateExport().Value; return true; } else { asyncGateway = null; return false; } }
public void TryGetAsyncCloudGatewayForSchema_WhereGatewayIsUndefined_Fails() { var asyncGateways = new[] { new ExportFactory <IAsyncCloudGateway, CloudGatewayMetadata>(() => Fixture.GetAsyncCreator(), Fixture.GetAsyncGatewayMetadata()) }; var syncGateways = Enumerable.Empty <ExportFactory <ICloudGateway, CloudGatewayMetadata> >(); var sut = new GatewayManager(asyncGateways, syncGateways); IAsyncCloudGateway asyncGateway = null; var result = sut.TryGetAsyncCloudGatewayForSchema("undefinedAsync", out asyncGateway); Assert.IsFalse(result, "Unconfigured AsyncCloudGateway returned"); }
public void TryGetAsyncCloudGatewayForSchema_WhereNoGatewaysAreDefined_Fails() { var asyncGateways = Enumerable.Empty <ExportFactory <IAsyncCloudGateway, CloudGatewayMetadata> >(); var syncGateways = Enumerable.Empty <ExportFactory <ICloudGateway, CloudGatewayMetadata> >(); var sut = new GatewayManager(asyncGateways, syncGateways); IAsyncCloudGateway asyncGateway = null; var result = sut.TryGetAsyncCloudGatewayForSchema("testAsync", out asyncGateway); Assert.IsFalse(result, "Unconfigured AsyncCloudGateway returned"); }
public bool TryGetAsyncCloudGatewayForSchema(string cloudService, out IAsyncCloudGateway asyncGateway) { var result = default(ExportFactory <IAsyncCloudGateway, CloudGatewayMetadata>); if (asyncGateways.TryGetValue(cloudService, out result)) { asyncGateway = result.CreateExport().Value; return(true); } else { asyncGateway = null; return(false); } }
private TestDirectoryFixture(IAsyncCloudGateway gateway, RootName root, string apiKey, IDictionary <string, string> parameters, string path) { this.gateway = gateway; this.root = root; var rootDirectory = gateway.GetRootAsync(root, apiKey, parameters).Result; var residualDirectory = gateway.GetChildItemAsync(root, rootDirectory.Id).Result.SingleOrDefault(f => f.Name == path) as DirectoryInfoContract; if (residualDirectory != null) { gateway.RemoveItemAsync(root, residualDirectory.Id, true).Wait(); } directory = gateway.NewDirectoryItemAsync(root, rootDirectory.Id, path).Result; }
public bool TryGetAsyncCloudGatewayForSchema(string cloudService, out IAsyncCloudGateway asyncGateway) { if (_asyncGateways.TryGetValue(cloudService, out ExportFactory <IAsyncCloudGateway, CloudGatewayMetadata> result)) { using (var export = result.CreateExport()) { asyncGateway = export.Value; return(true); } } else { asyncGateway = null; return(false); } }
public AsyncCloudDrive(RootName rootName, IAsyncCloudGateway gateway, CloudDriveParameters parameters) : base(rootName, parameters) { this.gateway = gateway; }
public AsyncCloudDrive(RootName rootName, IAsyncCloudGateway gateway, CloudDriveParameters parameters) : base(rootName, parameters) { this.gateway = gateway; this.parameters = parameters.Parameters; }
internal static TestDirectoryFixture CreateTestDirectory(IAsyncCloudGateway gateway, GatewayElement config, GatewayTestsFixture fixture) { return(new TestDirectoryFixture(gateway, fixture.GetRootName(config), config.ApiKey, fixture.GetParameters(config), config.TestDirectory)); }
public AsyncCloudDrive(PSDriveInfo driveInfo, RootName rootName, IAsyncCloudGateway gateway, CloudDriveParameters parameters) : base(driveInfo, rootName, parameters) { this.gateway = gateway; }