public void ShouldNotParseIncorrectString(string inputString) { Assert.IsFalse(FileLine.TryParse(inputString, out var fileLine)); Assert.AreEqual(FileLine.None, fileLine); if (inputString != null) { using (var streamReader = new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(inputString)))) { Assert.IsFalse(FileLine.TryParse(streamReader, out fileLine)); Assert.AreEqual(FileLine.None, fileLine); } } }
public void ShouldParseCorrectString(string inputString, int number, string name, long size) { Assert.IsTrue(FileLine.TryParse(inputString, out var fileLine)); Assert.AreEqual(number, fileLine.Number); Assert.AreEqual(name, fileLine.Name); Assert.AreEqual(size, fileLine.Size); if (inputString != null) { using (var streamReader = new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(inputString)))) { Assert.IsTrue(FileLine.TryParse(streamReader, out fileLine)); Assert.AreEqual(number, fileLine.Number); Assert.AreEqual(name, fileLine.Name); Assert.AreEqual(size, fileLine.Size); } } }