Exemplo n.º 1
0
        public void VerifyParserParsesLineWithoutReferenceSuccessfully()
        {
            var expectedChange = new DefaultChange(new ChangeVersion("0.1.0"), "Some Change Type", "Some Summary", DateTimeOffset.Now.Date);
            var line           = $"{expectedChange.Version}|{expectedChange.ChangeType}|{expectedChange.Summary}|{expectedChange.Date:yyyy-MM-dd}";
            var writer         = new StringWriter();
            var parser         = new DefaultFileSourceRowParser(writer);
            var actual         = parser.Parse(line);

            Assert.That(actual, Is.EqualTo(expectedChange));
        }
Exemplo n.º 2
0
        public void VerifyParserHandlesDateFormatIssues()
        {
            var expectedChange = new DefaultChange(new ChangeVersion("0.1.0"), "Some Change Type", "Some Summary", DateTimeOffset.Now.Date);
            var line           = $"{expectedChange.Version}|{expectedChange.ChangeType}|{expectedChange.Summary}|{expectedChange.Date}";
            var writer         = new StringWriter();
            var parser         = new DefaultFileSourceRowParser(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'"));
        }
Exemplo n.º 3
0
        public void VerifyParserHandlesTooManyDelimiterIssues()
        {
            var expectedChange = new DefaultChange(new ChangeVersion("0.1.0"), "Some Change Type", "Some Summary", DateTimeOffset.Now.Date);
            var line           = $"{expectedChange.Version}|||{expectedChange.ChangeType}|{expectedChange.Summary}|{expectedChange.Date:yyyy-MM-dd}";
            var writer         = new StringWriter();
            var parser         = new DefaultFileSourceRowParser(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 4 or 5 but was 6"));
        }