示例#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));
        }
示例#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);
        }
示例#3
0
 public void ReportWarning_EmptyMessage_ThrowsException()
 {
     Assert.Throws <ArgumentException>(
         () => _errorReporter.ReportWarning(YamlUtils.CreateYamlNode("name: promitor"), string.Empty));
 }
示例#4
0
 public void ReportError_NullMessage_ThrowsException()
 {
     Assert.Throws <ArgumentException>(
         () => _errorReporter.ReportError(YamlUtils.CreateYamlNode("name: promitor"), null));
 }