NuGet.Test.Mocks.MockFileSystem.FileExists C# (CSharp) Method

FileExists() public method

public FileExists ( string path ) : bool
path string
return bool
        public virtual bool FileExists(string path)
        {
            return Paths.ContainsKey(path);
        }

Usage Example

        public void CallAddPackageWillAddNupkgFileButNoNuspecFile(string id, string version, string nuspecPath, string nupkgPath)
        {
            // Arrange
            var fileSystem = new MockFileSystem("x:\\root");
            var configFileSystem = new MockFileSystem();
            var repository = new SharedPackageRepository(new DefaultPackagePathResolver(fileSystem), fileSystem, configFileSystem);
            
            // Act            
            repository.AddPackage(PackageUtility.CreatePackage(id, version));

            // Assert
            Assert.False(fileSystem.FileExists(nuspecPath));
            Assert.True(fileSystem.FileExists(nupkgPath));
        }
All Usage Examples Of NuGet.Test.Mocks.MockFileSystem::FileExists