示例#1
0
        public void VerifyParserParsesLineWithoutReferenceSuccessfully()
        {
            var expectedChange = new ProjectChange("MyProj", "0.1.0", "Some Tag", "Some Summary", DateTimeOffset.Now.Date);
            var line           = $"{expectedChange.Project}|{expectedChange.Version}|{expectedChange.Tag}|{expectedChange.Summary}|{expectedChange.Date:yyyy-MM-dd}";
            var writer         = new StringWriter();
            var parser         = new ProjectFileSourceRowParser(writer);
            var actual         = parser.Parse(line);

            Assert.That(actual, Is.EqualTo(expectedChange));
        }
示例#2
0
        public void VerifyParserHandlesDateFormatIssues()
        {
            var expectedChange = new ProjectChange("MyProj", "0.1.0", "Some Tag", "Some Summary", DateTimeOffset.Now.Date);
            var line           = $"{expectedChange.Project}|{expectedChange.Version}|{expectedChange.Tag}|{expectedChange.Summary}|{expectedChange.Date}";
            var writer         = new StringWriter();
            var parser         = new ProjectFileSourceRowParser(writer);
            var actual         = parser.Parse(line);

            Assert.That(actual, Is.Null);
            Assert.That(writer.ToString().Trim(), Is.EqualTo($"Error parsing line '{line}'. Date should match the format 'yyyy-MM-dd'"));
        }
示例#3
0
        public void VerifyParserHandlesTooManyDelimiterIssues()
        {
            var expectedChange = new ProjectChange("MyProj", "0.1.0", "Some Tag", "Some Summary", DateTimeOffset.Now.Date);
            var line           = $"{expectedChange.Project}|{expectedChange.Version}|||{expectedChange.Tag}|{expectedChange.Summary}|{expectedChange.Date:yyyy-MM-dd}";
            var writer         = new StringWriter();
            var parser         = new ProjectFileSourceRowParser(writer);
            var actual         = parser.Parse(line);

            Assert.That(actual, Is.Null);
            Assert.That(writer.ToString().Trim(), Is.EqualTo($"Error parsing line '{line}'. Wrong number of values. Expected 5 or 6 but was 7"));
        }