public ServerGeneralSettings GetGeneral() { _client.Executor.CheckApiServerVersion(); IRestRequest request = _client.Builder.GetGeneralSettings(); ApiGeneralSettings apiGeneralSettings = _client.Executor.DoSyncApiCall <ApiGeneralSettings>(request, DracoonRequestExecutor.RequestType.GetGeneralSettings); return(SettingsMapper.FromApiGeneralSettings(apiGeneralSettings)); }
public void FromApiGeneralSettings_Null() { // ARRANGE ServerGeneralSettings expected = null; ApiGeneralSettings param = null; // ACT ServerGeneralSettings actual = SettingsMapper.FromApiGeneralSettings(param); // ASSERT Assert.Equal(expected, actual, new ServerGeneralSettingsComparer()); }
public void GetGeneral() { // ARRANGE ServerGeneralSettings expected = FactoryServerSettings.ServerGeneralSettings; IInternalDracoonClient c = FactoryClients.InternalDracoonClientMock(true); DracoonServerSettingsImpl ss = new DracoonServerSettingsImpl(c); Mock.Arrange(() => c.Builder.GetGeneralSettings()).Returns(FactoryRestSharp.RestRequestWithAuth(ApiConfig.ApiGetGeneralConfig, Method.GET)).Occurs(1); Mock.Arrange(() => c.Executor.DoSyncApiCall <ApiGeneralSettings>(Arg.IsAny <IRestRequest>(), RequestType.GetGeneralSettings, 0)).Returns(FactoryServerSettings.ApiGeneralSettings).Occurs(1); Mock.Arrange(() => SettingsMapper.FromApiGeneralSettings(Arg.IsAny <ApiGeneralSettings>())).Returns(FactoryServerSettings.ServerGeneralSettings).Occurs(1); // ACT ServerGeneralSettings actual = ss.GetGeneral(); // ASSERT Assert.Equal(expected, actual, new ServerGeneralSettingsComparer()); Mock.Assert(() => SettingsMapper.FromApiGeneralSettings(Arg.IsAny <ApiGeneralSettings>())); Mock.Assert(c.Executor); Mock.Assert(c.Builder); }
public void FromApiGeneralSettings() { // ARRANGE ServerGeneralSettings expected = FactoryServerSettings.ServerGeneralSettings; ApiGeneralSettings param = new ApiGeneralSettings { CryptoEnabled = expected.CryptoEnabled, EmailNotificationButtonEnabled = expected.EmailNotificationButtonEnabled, EulaEnabled = expected.EulaEnabled, MediaServerEnabled = expected.MediaServerEnabled, SharePasswordSmsEnabled = expected.SharePasswordSmsEnabled, UseS3Storage = expected.UseS3Storage, WeakPasswordEnabled = expected.WeakPasswordEnabled }; // ACT ServerGeneralSettings actual = SettingsMapper.FromApiGeneralSettings(param); // ASSERT Assert.Equal(expected, actual, new ServerGeneralSettingsComparer()); }