public void ContentEquals_ThrowsForNullStreamTaskFactory() { var exception = Assert.Throws <ArgumentNullException>( () => FileSystemUtility.ContentEquals( path: "a", streamFactory: null)); Assert.Equal("streamFactory", exception.ParamName); }
public void ContentEquals_ThrowsForNullOrEmptyPath(string path) { var exception = Assert.Throws <ArgumentException>( () => FileSystemUtility.ContentEquals( path: null, streamFactory: () => Stream.Null)); Assert.Equal("path", exception.ParamName); }
public void ContentEquals_ReturnsFalseIfNotEqual() { using (var stream = new MemoryStream(Encoding.UTF8.GetBytes("a"))) using (var testDirectory = TestDirectory.Create()) { var filePath = Path.Combine(testDirectory.Path, "file"); File.WriteAllText(filePath, "b"); var areEqual = FileSystemUtility.ContentEquals(filePath, () => stream); Assert.False(areEqual); } }