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