Esempio n. 1
0
        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();
            //...
        }
Esempio n. 2
0
        public void FromApiGeneralSettings_Null()
        {
            // ARRANGE
            ServerGeneralSettings expected = null;
            ApiGeneralSettings    param    = null;

            // ACT
            ServerGeneralSettings actual = SettingsMapper.FromApiGeneralSettings(param);

            // ASSERT
            Assert.Equal(expected, actual, new ServerGeneralSettingsComparer());
        }
Esempio n. 3
0
        internal static ServerGeneralSettings FromApiGeneralSettings(ApiGeneralSettings apiGeneralConfig)
        {
            if (apiGeneralConfig == null)
            {
                return(null);
            }

            ServerGeneralSettings general = new ServerGeneralSettings {
                CryptoEnabled = apiGeneralConfig.CryptoEnabled,
                EmailNotificationButtonEnabled = apiGeneralConfig.EmailNotificationButtonEnabled,
                EulaEnabled             = apiGeneralConfig.EulaEnabled,
                MediaServerEnabled      = apiGeneralConfig.MediaServerEnabled,
                SharePasswordSmsEnabled = apiGeneralConfig.SharePasswordSmsEnabled,
                UseS3Storage            = apiGeneralConfig.UseS3Storage,
                WeakPasswordEnabled     = apiGeneralConfig.WeakPasswordEnabled
            };

            return(general);
        }
        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);
        }
Esempio n. 5
0
        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());
        }