コード例 #1
0
            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();
            }
コード例 #2
0
            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();
            }