mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-13 15:13:31 +01:00
* net451 * tests : net462 * fixed tests * fix tests * readme * Code review * LocalFileSystemHandlerTests * refactor
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using WireMock.Handlers;
|
|
|
|
namespace WireMock.Net.ConsoleApplication
|
|
{
|
|
internal class CustomFileSystemFileHandler : IFileSystemHandler
|
|
{
|
|
private static readonly string AdminMappingsFolder = Path.Combine("__admin", "mappings");
|
|
|
|
/// <inheritdoc cref="IFileSystemHandler.FolderExists"/>
|
|
public bool FolderExists(string path)
|
|
{
|
|
return Directory.Exists(path);
|
|
}
|
|
|
|
/// <inheritdoc cref="IFileSystemHandler.CreateFolder"/>
|
|
public void CreateFolder(string path)
|
|
{
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
|
|
/// <inheritdoc cref="IFileSystemHandler.EnumerateFiles"/>
|
|
public IEnumerable<string> EnumerateFiles(string path)
|
|
{
|
|
return Directory.EnumerateFiles(path);
|
|
}
|
|
|
|
/// <inheritdoc cref="IFileSystemHandler.GetMappingFolder"/>
|
|
public string GetMappingFolder()
|
|
{
|
|
return Path.Combine(@"c:\temp-wiremock", AdminMappingsFolder);
|
|
}
|
|
|
|
/// <inheritdoc cref="IFileSystemHandler.ReadMappingFile"/>
|
|
public string ReadMappingFile(string path)
|
|
{
|
|
return File.ReadAllText(path);
|
|
}
|
|
|
|
/// <inheritdoc cref="IFileSystemHandler.WriteMappingFile"/>
|
|
public void WriteMappingFile(string path, string text)
|
|
{
|
|
File.WriteAllText(path, text);
|
|
}
|
|
}
|
|
} |