private static void GetServerSettings() { ServerGeneralSettings generalSettings = dc.Server.ServerSettings.GetGeneral(); Console.WriteLine("Crypto is enabled: " + generalSettings.CryptoEnabled); Console.WriteLine("Media server is enabled: " + generalSettings.MediaServerEnabled); Console.WriteLine("Share password via SMS is enabled: " + generalSettings.SharePasswordSmsEnabled); Console.WriteLine("Weak passwords are enabled: " + generalSettings.WeakPasswordEnabled); ServerInfrastructureSettings infrastructureSettings = dc.Server.ServerSettings.GetInfrastructure(); //... }
public void FromApiInfrastructureSettings_Null() { // ARRANGE ServerInfrastructureSettings expected = null; ApiInfrastructureSettings param = null; // ACT ServerInfrastructureSettings actual = SettingsMapper.FromApiInfrastructureSettings(param); // ASSERT Assert.Equal(expected, actual, new ServerInfrastructureSettingsComparer()); }
internal static ServerInfrastructureSettings FromApiInfrastructureSettings(ApiInfrastructureSettings apiInfrastructureConfig) { if (apiInfrastructureConfig == null) { return(null); } ServerInfrastructureSettings infrastructure = new ServerInfrastructureSettings { MediaServerConfigEnabled = apiInfrastructureConfig.MediaServerConfigEnabled, S3DefaultRegion = apiInfrastructureConfig.S3DefaultRegion, SmsConfigEnabled = apiInfrastructureConfig.SmsConfigEnabled, S3EnforceDirectUpload = apiInfrastructureConfig.S3EnforceDirectUpload }; return(infrastructure); }
public void FromApiInfrastructureSettings() { // ARRANGE ServerInfrastructureSettings expected = FactoryServerSettings.ServerInfrastructureSettings; ApiInfrastructureSettings param = new ApiInfrastructureSettings { MediaServerConfigEnabled = expected.MediaServerConfigEnabled, S3DefaultRegion = expected.S3DefaultRegion, SmsConfigEnabled = expected.SmsConfigEnabled, S3EnforceDirectUpload = expected.S3EnforceDirectUpload }; // ACT ServerInfrastructureSettings actual = SettingsMapper.FromApiInfrastructureSettings(param); // ASSERT Assert.Equal(expected, actual, new ServerInfrastructureSettingsComparer()); }
public void GetInfrastructure() { // ARRANGE ServerInfrastructureSettings expected = FactoryServerSettings.ServerInfrastructureSettings; IInternalDracoonClient c = FactoryClients.InternalDracoonClientMock(true); DracoonServerSettingsImpl ss = new DracoonServerSettingsImpl(c); Mock.Arrange(() => c.Builder.GetInfrastructureSettings()).Returns(FactoryRestSharp.RestRequestWithAuth(ApiConfig.ApiGetInfrastructureConfig, Method.GET)).Occurs(1); Mock.Arrange(() => c.Executor.DoSyncApiCall <ApiInfrastructureSettings>(Arg.IsAny <IRestRequest>(), RequestType.GetInfrastructureSettings, 0)) .Returns(FactoryServerSettings.ApiInfrastructureSettings).Occurs(1); Mock.Arrange(() => SettingsMapper.FromApiInfrastructureSettings(Arg.IsAny <ApiInfrastructureSettings>())) .Returns(FactoryServerSettings.ServerInfrastructureSettings).Occurs(1); // ACT ServerInfrastructureSettings actual = ss.GetInfrastructure(); // ASSERT Assert.Equal(expected, actual, new ServerInfrastructureSettingsComparer()); Mock.Assert(() => SettingsMapper.FromApiInfrastructureSettings(Arg.IsAny <ApiInfrastructureSettings>())); Mock.Assert(c.Executor); Mock.Assert(c.Builder); }