示例#1
0
 public BackgroundWorkerSettingsProvider()
 {
     // Most config values we can leave uninitialized, and they'll be loaded from the first config parse,
     // but if we don't initialize this to something non-zero, the config parse will never be able to run.
     _settings = new BackgroundWorkerSettings()
     {
         InstructionsPerTick = 1000
     };
 }
        public void Settings_Always_SavesValue(int instructionsPerExecution)
        {
            var uut = new BackgroundWorkerSettingsProvider();

            var settings = new BackgroundWorkerSettings()
            {
                InstructionsPerTick = instructionsPerExecution
            };

            uut.Settings = settings;

            uut.Settings.ShouldBe(settings);
        }
        public void OnCompleted_Always_DoesNothing(int instructionsPerTick)
        {
            var uut = new BackgroundWorkerSettingsProvider();

            var settings = new BackgroundWorkerSettings()
            {
                InstructionsPerTick = instructionsPerTick
            };

            uut.Settings = settings;

            uut.OnCompleted();

            uut.Settings.ShouldBe(settings);
        }
示例#4
0
 public void OnStarting()
 => _settings = new BackgroundWorkerSettings()
 {
     InstructionsPerTick = 1000
 };
 public static void ShouldBe(this BackgroundWorkerSettings settings, BackgroundWorkerSettings expected)
 {
     settings.InstructionsPerTick.ShouldBe(expected.InstructionsPerTick);
 }