public void ShouldWriteHelpMessage() { var fileDataContext = new FileDataContext(new string[2] { "-z", "c:/test" }); var stringWriter = new StringWriter(); fileDataContext.Write(stringWriter); Assert.That(stringWriter.ToString().Contains(FileDataContext.HelpMessage)); }
public void ShouldWriteSize() { const int size = 100000; var filePath = "c:/test"; var fileDetails = new Mock <IFileDetails>(MockBehavior.Strict); fileDetails.Setup(p => p.Size(filePath)).Returns(size); var fileDataContext = new FileDataContext(new string[2] { "-s", filePath }, new FileDataOptionSet(), fileDetails.Object); var stringWriter = new StringWriter(); fileDataContext.Write(stringWriter); Assert.AreEqual(size.ToString(), stringWriter.ToString()); fileDetails.VerifyAll(); }
public void ShouldWriteVersion() { const string version = "EXPECTED_VERSION"; var filePath = "c:/test"; var fileDetails = new Mock <IFileDetails>(MockBehavior.Strict); fileDetails.Setup(p => p.Version(filePath)).Returns(version); var fileDataContext = new FileDataContext(new string[2] { "-v", filePath }, new FileDataOptionSet(), fileDetails.Object); var stringWriter = new StringWriter(); fileDataContext.Write(stringWriter); Assert.AreEqual(version, stringWriter.ToString()); fileDetails.VerifyAll(); }