public void IsAttributeDefinition_gives_correct_result(string input, bool expected) { var line = new InputLine(1) { Data = input }; var result = line.IsAttributeDefinition(); Assert.Equal(expected, result); }
public static AttributeDefinition ToAttributeDefinition(this InputLine line) { if (!line.IsAttributeDefinition()) { return(null); } var index = line.Data.IndexOf(Constants.AssignmentOperator); var result = new AttributeDefinition(); if (index > 0) { result.Name = line.Data.Substring(0, index).Trim(); } if (index < line.Data.Length) { result.Value = line.Data.Substring(index + 1).Trim(); } return(result); }