2017-11-27 18:45:43 +00:00
|
|
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using Microsoft.Extensions.EnvironmentAbstractions;
|
|
|
|
|
2017-12-04 22:13:24 +00:00
|
|
|
namespace Microsoft.DotNet.ShellShim.Tests
|
2017-11-27 18:45:43 +00:00
|
|
|
{
|
|
|
|
internal class FakeFile : IFile
|
|
|
|
{
|
|
|
|
private Dictionary<string, string> _files;
|
|
|
|
|
|
|
|
public FakeFile(Dictionary<string, string> files)
|
|
|
|
{
|
|
|
|
_files = files;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool Exists(string path)
|
|
|
|
{
|
|
|
|
return _files.ContainsKey(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
public string ReadAllText(string path)
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
public Stream OpenRead(string path)
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
public Stream OpenFile(string path, FileMode fileMode, FileAccess fileAccess, FileShare fileShare,
|
|
|
|
int bufferSize,
|
|
|
|
FileOptions fileOptions)
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CreateEmptyFile(string path)
|
|
|
|
{
|
|
|
|
_files.Add(path, String.Empty);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void WriteAllText(string path, string content)
|
|
|
|
{
|
|
|
|
_files[path] = content;
|
|
|
|
}
|
|
|
|
|
2018-01-28 21:35:04 +00:00
|
|
|
public void Move(string source, string destination)
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
2018-02-06 21:38:06 +00:00
|
|
|
public void Delete(string path)
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
2017-11-27 18:45:43 +00:00
|
|
|
public static FakeFile Empty => new FakeFile(new Dictionary<string, string>());
|
|
|
|
}
|
|
|
|
}
|