public InMemoryFeatureRepository(IResourcePaths resourcePaths) { this.resourcePaths = resourcePaths; this.storedValues = Serialization.ReadFromBinaryFile <List <StorageModel> >(resourcePaths.DataDumpFile); if (this.storedValues == null) { this.storedValues = new List <StorageModel>(); } }
public SettingsPersister( IResourcePaths paths, ISettingsProvider settingsProvider, IYamlSerializerFactory serializerFactory, IFileSystem fileSystem) { _paths = paths; _settingsProvider = settingsProvider; _serializerFactory = serializerFactory; _fileSystem = fileSystem; }
public void Load_should_create_settings_file_if_not_exists( [Frozen(Matching.ImplementedInterfaces)] MockFileSystem fileSystem, [Frozen] IResourcePaths paths, SettingsPersister sut) { paths.SettingsPath.Returns("test_path"); sut.Load(); fileSystem.AllFiles.Should().ContainSingle(x => x.EndsWith(paths.SettingsPath)); }
public void Get_custom_format_json_works( [Frozen] IResourcePaths paths, [Frozen(Matching.ImplementedInterfaces)] MockFileSystem fileSystem, LocalRepoCustomFormatJsonParser sut) { paths.RepoPath.Returns(""); fileSystem.AddFile("docs/json/radarr/first.json", new MockFileData("first")); fileSystem.AddFile("docs/json/radarr/second.json", new MockFileData("second")); var results = sut.GetCustomFormatJson(); results.Should().BeEquivalentTo("first", "second"); }
public RepoUpdater( ILogger log, IResourcePaths paths, IGitRepositoryFactory repositoryFactory, IFileUtilities fileUtils, ISettingsProvider settingsProvider) { _log = log; _repositoryFactory = repositoryFactory; _fileUtils = fileUtils; _settingsProvider = settingsProvider; RepoPath = paths.RepoPath; }
public LocalRepoCustomFormatJsonParser( ILogger log, IFileSystem fileSystem, IResourcePaths paths, IGitRepositoryFactory repositoryFactory, IFileUtilities fileUtils, ISettingsProvider settingsProvider) { _log = log; _fileSystem = fileSystem; _repositoryFactory = repositoryFactory; _fileUtils = fileUtils; _settingsProvider = settingsProvider; _repoPath = paths.RepoPath; }
public EmbeddingExtractor(IResourcePaths resourcePaths) { this.tfGraph = new TFGraph(); var model = File.ReadAllBytes(resourcePaths.ModelPath); this.tfGraph.Import(model); var session = new TFSession(this.tfGraph); this.runner = session.GetRunner(); var layerNames = this.tfGraph.GetEnumerator().Select(x => x.Name).ToArray(); this.inputLayerName = layerNames[0]; this.outputLayerName = layerNames[layerNames.Length - 1]; }
public void Load_defaults_when_file_does_not_exist( [Frozen(Matching.ImplementedInterfaces)] MockFileSystem fileSystem, [Frozen(Matching.ImplementedInterfaces)] YamlSerializerFactory serializerFactory, [Frozen(Matching.ImplementedInterfaces)] SettingsProvider settingsProvider, [Frozen] IResourcePaths paths, SettingsPersister sut) { paths.SettingsPath.Returns("test_path"); sut.Load(); var expectedSettings = new SettingsValues(); settingsProvider.Settings.Should().BeEquivalentTo(expectedSettings); }
public void Load_data_correctly_when_file_exists( [Frozen(Matching.ImplementedInterfaces)] MockFileSystem fileSystem, [Frozen] IYamlSerializerFactory serializerFactory, [Frozen] IResourcePaths paths, SettingsPersister sut) { // For this test, it doesn't really matter if the YAML data matches what SettingsValue expects; // this test only ensures that the data deserialized is from the actual correct file. var expectedYamlData = @" repository: clone_url: http://the_url.com "; var deserializer = Substitute.For <IDeserializer>(); serializerFactory.CreateDeserializer().Returns(deserializer); paths.SettingsPath.Returns("test_path"); fileSystem.AddFile(paths.SettingsPath, new MockFileData(expectedYamlData)); sut.Load(); deserializer.Received().Deserialize <SettingsValues>(expectedYamlData); }
public LocalRepoReleaseProfileJsonParser(IFileSystem fileSystem, IResourcePaths paths) { _fileSystem = fileSystem; _paths = paths; }
public VoicePathSource(IResourcePaths resourcePaths) { this.resourcePaths = resourcePaths; }
public LocalRepoCustomFormatJsonParser(IFileSystem fileSystem, IResourcePaths paths) { _fileSystem = fileSystem; _paths = paths; }
public void Get_custom_format_json_works( [Frozen] IResourcePaths paths, [Frozen(Matching.ImplementedInterfaces)] MockFileSystem fileSystem, LocalRepoReleaseProfileJsonParser sut) {
public VoicePreprocessor(IResourcePaths resourcePaths) { this.resourcePaths = resourcePaths; }