public IEnumerable <string> Validate(Settings1 settings)
 {
     if (settings.Value == null)
     {
         yield return($"{nameof(settings.Value)} must not be null!");
     }
 }
예제 #2
0
        public void ShouldAllowDefaultSettings()
        {
            if (File.Exists(SettingsFileName))
                File.Delete(SettingsFileName);

            var s1 = new Settings1();
            var s2 = new Settings2();

            Settings.Init(SettingsFileName, s1, s2);

            s1.S1.Should().Be("default S1 value");
            s1.S2.Should().BeNull();
            s2.S1.Should().Be("same name, different value");
        }
 public ModelSettings()
 {
     if (_settings == null)
     {
         _settings = new Settings1();
     }
     version              = _settings.Version;
     nameProgram          = _settings.NameProgram;
     aboutProgram         = _settings.AboutProgram;
     _pathSaveResult      = _settings.PathSaveResult;
     _countPhoto          = _settings.CountPhoto;
     _powerLaser          = _settings.PowerLaser;
     _speedConnectComPort = _settings.SpeedConnectComPort;
 }