Exemple #1
0
        GlobalSettingsHolder SettingsProvider.Provide()
        {
            this.checkAndRecreate();

            var settings  = new GlobalSettingsHolder();
            var appConfig = Settings.Default;

            try
            {
                settings.TitleText = appConfig.TitleText;
            }
            catch
            {
                // swallow
            }

            try
            {
                settings.Prompt = appConfig.Prompt;
            }
            catch
            {
                // swallow
            }

            try
            {
                settings.ShowSeconds = appConfig.ShowSeconds;
            }
            catch
            {
                // swallow
            }

            try
            {
                var interval = appConfig.TimerIntervalSeconds;
                if (interval < 1)
                {
                    interval = 1;
                }

                settings.TimerIntervalSeconds = interval;
            }
            catch
            {
                // swallow
            }

            return(settings);
        }
            public void Registers_the_result_of_provider_Provide()
            {
                var settings = new GlobalSettingsHolder();

                A
                .CallTo(() => this.provider.Provide())
                .Returns(settings);

                this.command.Execute();

                Assert.NotNull(
                    this.web.Run <GlobalSettingsHolder>());
                Assert.Same(
                    settings,
                    this.web.Run <GlobalSettingsHolder>());
            }