public ServerDefaultSettings GetDefault() { _client.Executor.CheckApiServerVersion(); IRestRequest request = _client.Builder.GetDefaultsSettings(); ApiDefaultsSettings apiDefaultsSettings = _client.Executor.DoSyncApiCall <ApiDefaultsSettings>(request, DracoonRequestExecutor.RequestType.GetDefaultsSettings); return(SettingsMapper.FromApiDefaultsSettings(apiDefaultsSettings)); }
public void FromApiDefaultsSettings_Null() { // ARRANGE ServerDefaultSettings expected = null; ApiDefaultsSettings param = null; // ACT ServerDefaultSettings actual = SettingsMapper.FromApiDefaultsSettings(param); // ASSERT Assert.Equal(expected, actual, new ServerDefaultSettingsComparer()); }
public void FromApiDefaultsSettings() { // ARRANGE ServerDefaultSettings expected = FactoryServerSettings.ServerDefaultSettings; ApiDefaultsSettings param = new ApiDefaultsSettings { DownloadShareDefaultExpirationPeriodInDays = expected.DownloadShareDefaultExpirationPeriodInDays, FileUploadDefaultExpirationPeriodInDays = expected.FileUploadDefaultExpirationPeriodInDays, LanguageDefault = expected.LanguageDefault, UploadShareDefaultExpirationPeriodInDays = expected.UploadShareDefaultExpirationPeriodInDays }; // ACT ServerDefaultSettings actual = SettingsMapper.FromApiDefaultsSettings(param); // ASSERT Assert.Equal(expected, actual, new ServerDefaultSettingsComparer()); }
public void GetDefault() { // ARRANGE ServerDefaultSettings expected = FactoryServerSettings.ServerDefaultSettings; IInternalDracoonClient c = FactoryClients.InternalDracoonClientMock(true); DracoonServerSettingsImpl ss = new DracoonServerSettingsImpl(c); Mock.Arrange(() => c.Builder.GetDefaultsSettings()).Returns(FactoryRestSharp.RestRequestWithAuth(ApiConfig.ApiGetDefaultsConfig, Method.GET)).Occurs(1); Mock.Arrange(() => c.Executor.DoSyncApiCall <ApiDefaultsSettings>(Arg.IsAny <IRestRequest>(), RequestType.GetDefaultsSettings, 0)).Returns(FactoryServerSettings.ApiDefaultsSettings).Occurs(1); Mock.Arrange(() => SettingsMapper.FromApiDefaultsSettings(Arg.IsAny <ApiDefaultsSettings>())).Returns(FactoryServerSettings.ServerDefaultSettings).Occurs(1); // ACT ServerDefaultSettings actual = ss.GetDefault(); // ASSERT Assert.Equal(expected, actual, new ServerDefaultSettingsComparer()); Mock.Assert(() => SettingsMapper.FromApiDefaultsSettings(Arg.IsAny <ApiDefaultsSettings>())); Mock.Assert(c.Executor); Mock.Assert(c.Builder); }