Esempio n. 1
0
        public void Messages_MultipleMessagesAdded_ReturnedInOrderOfLineNumber()
        {
            // Arrange
            var node = YamlUtils.CreateYamlNode(
                @"firstNode: one
secondNode: two
thirdNode: three");

            _errorReporter.ReportWarning(node.Children["secondNode"], "second");
            _errorReporter.ReportError(node.Children["firstNode"], "first");
            _errorReporter.ReportWarning(node.Children["thirdNode"], "third");

            // Act
            var messages = _errorReporter.Messages;

            // Assert
            Assert.Collection(messages,
                              m => Assert.Equal("first", m.Message),
                              m => Assert.Equal("second", m.Message),
                              m => Assert.Equal("third", m.Message));
        }
Esempio n. 2
0
        public void GetDictionary_PropertySpecified_DeserializesDictionary()
        {
            // Arrange
            const string yamlText =
                @"labels:
    env: production
    tier: web";
            var node = YamlUtils.CreateYamlNode(yamlText);

            // Act
            var labels = node.GetDictionary("labels");

            // Assert
            var expected = new Dictionary <string, string>
            {
                { "env", "production" },
                { "tier", "web" }
            };

            Assert.Equal(expected, labels);
        }
Esempio n. 3
0
 public void ReportWarning_EmptyMessage_ThrowsException()
 {
     Assert.Throws <ArgumentException>(
         () => _errorReporter.ReportWarning(YamlUtils.CreateYamlNode("name: promitor"), string.Empty));
 }
Esempio n. 4
0
 public void ReportError_NullMessage_ThrowsException()
 {
     Assert.Throws <ArgumentException>(
         () => _errorReporter.ReportError(YamlUtils.CreateYamlNode("name: promitor"), null));
 }