Esempio n. 1
0
        protected override void ProcessRecord()
        {
            try
            {
                if (_settingsReaders.Count > 0)
                {
                    var settingsLines = new List <string>();

                    foreach (var reader in _settingsReaders)
                    {
                        settingsLines.AddRange(reader.ReadSettings());
                    }

                    _parser.Validate(settingsLines);
                }
            }
            catch (Exception e)
            {
                ThrowTerminatingError(
                    new ErrorRecord(
                        e,
                        "SettingsWarnings",
                        ErrorCategory.NotSpecified,
                        this)
                    );
            }
        }
Esempio n. 2
0
        public void SettingsParser_Validate_Should_Raise_RevertedValue_Warnings()
        {
            var warnings = new HashSet <string>();
            var sp       = new SettingsParser
            {
                WriteWarning = s => warnings.Add(s)
            };

            var reader = GetSettingsFileReader(SettingsWithInheritanceAndRevertedValueWarnings);

            sp.Validate(reader.ReadSettings());

            CollectionAssert.IsNotEmpty(warnings);
            Assert.AreEqual(2, warnings.Count);
        }