public void ExportGateway(ICloudGateway gateway) { var gatewayMetadata = new Dictionary<string, object>() { { nameof(CloudGatewayMetadata.CloudService), MOCKGATEWAY_NAME } }; CompositionInitializer.ConfigurationPreset = new ContainerConfiguration() .WithExport(gateway, metadata: gatewayMetadata); }
public TestDirectory(ICloudGateway gateway, RootName root, string apiKey, string path) { this.gateway = gateway; this.root = root; var rootDirectory = gateway.GetRoot(root, apiKey); directory = gateway.NewDirectoryItem(root, rootDirectory.Id, path); }
public void ExportGateway(ICloudGateway gateway) { var gatewayMetadata = new Dictionary <string, object>() { { nameof(CloudGatewayMetadata.CloudService), MOCKGATEWAY_NAME } }; CompositionInitializer.ConfigurationPreset = new ContainerConfiguration() .WithExport(gateway, metadata: gatewayMetadata); }
public bool TryGetCloudGatewayForSchema(string cloudService, out ICloudGateway gateway) { var result = default(ExportFactory<ICloudGateway, CloudGatewayMetadata>); if (gateways.TryGetValue(cloudService, out result)) { gateway = result.CreateExport().Value; return true; } else { gateway = null; return false; } }
public void TryGetCloudGatewayForSchema_WhereGatewayIsUndefined_Fails() { var asyncGateways = Enumerable.Empty <ExportFactory <IAsyncCloudGateway, CloudGatewayMetadata> >(); var syncGateways = new[] { new ExportFactory <ICloudGateway, CloudGatewayMetadata>(() => Fixture.GetSyncCreator(), Fixture.GetSyncGatewayMetadata()) }; var sut = new GatewayManager(asyncGateways, syncGateways); ICloudGateway syncGateway = null; var result = sut.TryGetCloudGatewayForSchema("undefinedSync", out syncGateway); Assert.IsFalse(result, "Unconfigured CloudGateway returned"); }
public void TryGetCloudGatewayForSchema_WhereNoGatewaysAreDefined_Fails() { var asyncGateways = Enumerable.Empty <ExportFactory <IAsyncCloudGateway, CloudGatewayMetadata> >(); var syncGateways = Enumerable.Empty <ExportFactory <ICloudGateway, CloudGatewayMetadata> >(); var sut = new GatewayManager(asyncGateways, syncGateways); ICloudGateway syncGateway = null; var result = sut.TryGetCloudGatewayForSchema("testSync", out syncGateway); Assert.IsFalse(result, "Unconfigured CloudGateway returned"); }
public bool TryGetCloudGatewayForSchema(string cloudService, out ICloudGateway gateway) { var result = default(ExportFactory <ICloudGateway, CloudGatewayMetadata>); if (gateways.TryGetValue(cloudService, out result)) { gateway = result.CreateExport().Value; return(true); } else { gateway = null; return(false); } }
public bool TryGetCloudGatewayForSchema(string cloudService, out ICloudGateway gateway) { if (_gateways.TryGetValue(cloudService, out ExportFactory <ICloudGateway, CloudGatewayMetadata> result)) { using (var export = result.CreateExport()) { gateway = export.Value; return(true); } } else { gateway = null; return(false); } }
private TestDirectoryFixture(ICloudGateway gateway, RootName root, string apiKey, IDictionary <string, string> parameters, string path) { this.gateway = gateway; this.root = root; gateway.GetDrive(root, apiKey, parameters); var rootDirectory = gateway.GetRoot(root, apiKey, parameters); var residualDirectory = gateway.GetChildItem(root, rootDirectory.Id).SingleOrDefault(f => f.Name == path) as DirectoryInfoContract; if (residualDirectory != null) { gateway.RemoveItem(root, residualDirectory.Id, true); } directory = gateway.NewDirectoryItem(root, rootDirectory.Id, path); }
internal static TestDirectoryFixture CreateTestDirectory(ICloudGateway gateway, GatewayElement config, GatewayTestsFixture fixture) { return(new TestDirectoryFixture(gateway, fixture.GetRootName(config), config.ApiKey, fixture.GetParameters(config), config.TestDirectory)); }
public CloudDrive(RootName rootName, ICloudGateway gateway, CloudDriveParameters parameters) : base(rootName, parameters) { _gateway = gateway; _parameters = parameters.Parameters; }
public CloudDrive(PSDriveInfo driveInfo, RootName rootName, ICloudGateway gateway, CloudDriveParameters parameters) : base(driveInfo, rootName, parameters) { this.gateway = gateway; }
public CloudDrive(RootName rootName, ICloudGateway gateway, CloudDriveParameters parameters) : base(rootName, parameters) { this.gateway = gateway; }