public void ContextSetup() { const string filePath = @"C:\some\dir"; var configuration = new StubApplicationConfiguration { StorageFilePath = filePath }; _stubbedModel = new MasterModel(); var fileSystem = S <IFileSystem>(); fileSystem.Stub(x => x.FileExists(filePath)).Return(false); IJsonSerializerService doNotUseJsonSerializer = null; var storage = new FileSystemStorage(fileSystem, doNotUseJsonSerializer, configuration); _result = storage.ReadMasterModel(); }
public void ContextSetup() { var filePath = @"C:\some\dir\myfile.json"; _stubbedJson = "I am some json, I promise (just kidding)"; var model = new MasterModel(); _fileSystem = new FileSystemStub(); var jsonSerializer = S <IJsonSerializerService>(); jsonSerializer.Stub(x => x.SerializeMasterModel(model)).Return(_stubbedJson); var configuration = new StubApplicationConfiguration { StorageFilePath = filePath }; var storage = new FileSystemStorage(_fileSystem, jsonSerializer, configuration); storage.Save(model); _result = _fileSystem.GetLastWriteTo(filePath); }
public void ContextSetup() { const string filePath = @"C:\some\dir"; const string stubbedJson = "I am some json, I promise (just kidding)"; _stubbedModel = new MasterModel(); var fileSystem = new FileSystemStub(); fileSystem.StubContentForPath(filePath, stubbedJson); var jsonSerializer = S <IJsonSerializerService>(); jsonSerializer.Stub(x => x.DeserializeMasterModel(stubbedJson)).Return(_stubbedModel); var configuration = new StubApplicationConfiguration { StorageFilePath = filePath }; var storage = new FileSystemStorage(fileSystem, jsonSerializer, configuration); _result = storage.ReadMasterModel(); }