Код: Выделить всё
public class MyDictionary : IMyDictionary
{
IFileSystem _fileSystem;
public MyDictionary() : this (new FileSystem()) {}
public MyDictionary(IFileSystem fileSystem)
{
_fileSystem = fileSystem;
}
public Dictionary GetDictionary()
{
return JsonConvert.DeserializeObject x.File.ReadAllText("dictionary.json"))
.Returns(JsonConvert.SerializeObject(dic));
var cls = mock.Create();
var expected = dic;
var actual = cls.GetDictionary();
Assert.True(actual != null);
Assert.Equal(expected, actual);
}
}
Dictionary dic = new Dictionary
{
{ "Key1", "Value1" },
{"Key2", "Value2" }
};
Подробнее здесь: https://stackoverflow.com/questions/614 ... ext-method
Мобильная версия