I use moq 4.17.2 and FileSystem 17.0.3 for my tests.
For some reason, if the line (4) is included I always get null whenever I call fileSystem.Object.Path.Combine (e.g. in line (7)). But, when I remove line 4, then the Path.Combine works as expected. What can be the problem?
1. var fileSystem = new Mock<FileSystem> { CallBase = true }.As<IFileSystem>();
2. dirInfo.ExistingFiles.ForEach(existingFile =>
3. {
4. fileSystem.Setup(fs => fs.Path.GetDirectoryName(existingFile)).Returns("");
5. fileSystem.Setup(fs => fs.File.Exists(existingFile)).Returns(true);
6. });
7. var path = fileSystem.Object.Path.Combine("a", "b");
df