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 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);
        }
Esempio n. 5
0
 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;
     }
 }
Esempio n. 6
0
        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");
        }
Esempio n. 7
0
        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");
        }
Esempio n. 8
0
        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);
            }
        }
Esempio n. 9
0
            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;
            }
Esempio n. 10
0
 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);
     }
 }
Esempio n. 11
0
 public AsyncCloudDrive(RootName rootName, IAsyncCloudGateway gateway, CloudDriveParameters parameters) : base(rootName, parameters)
 {
     this.gateway = gateway;
 }
Esempio n. 12
0
 public AsyncCloudDrive(RootName rootName, IAsyncCloudGateway gateway, CloudDriveParameters parameters) : base(rootName, parameters)
 {
     this.gateway    = gateway;
     this.parameters = parameters.Parameters;
 }
Esempio n. 13
0
 internal static TestDirectoryFixture CreateTestDirectory(IAsyncCloudGateway gateway, GatewayElement config, GatewayTestsFixture fixture)
 {
     return(new TestDirectoryFixture(gateway, fixture.GetRootName(config), config.ApiKey, fixture.GetParameters(config), config.TestDirectory));
 }
Esempio n. 14
0
 public AsyncCloudDrive(PSDriveInfo driveInfo, RootName rootName, IAsyncCloudGateway gateway, CloudDriveParameters parameters) : base(driveInfo, rootName, parameters)
 {
     this.gateway = gateway;
 }
 public AsyncCloudDrive(PSDriveInfo driveInfo, RootName rootName, IAsyncCloudGateway gateway, CloudDriveParameters parameters) : base(driveInfo, rootName, parameters)
 {
     this.gateway = gateway;
 }