Exemplo n.º 1
0
        public InMemoryFeatureRepository(IResourcePaths resourcePaths)
        {
            this.resourcePaths = resourcePaths;
            this.storedValues  = Serialization.ReadFromBinaryFile <List <StorageModel> >(resourcePaths.DataDumpFile);

            if (this.storedValues == null)
            {
                this.storedValues = new List <StorageModel>();
            }
        }
Exemplo n.º 2
0
 public SettingsPersister(
     IResourcePaths paths,
     ISettingsProvider settingsProvider,
     IYamlSerializerFactory serializerFactory,
     IFileSystem fileSystem)
 {
     _paths             = paths;
     _settingsProvider  = settingsProvider;
     _serializerFactory = serializerFactory;
     _fileSystem        = fileSystem;
 }
Exemplo n.º 3
0
    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");
    }
Exemplo n.º 5
0
 public RepoUpdater(
     ILogger log,
     IResourcePaths paths,
     IGitRepositoryFactory repositoryFactory,
     IFileUtilities fileUtils,
     ISettingsProvider settingsProvider)
 {
     _log = log;
     _repositoryFactory = repositoryFactory;
     _fileUtils         = fileUtils;
     _settingsProvider  = settingsProvider;
     RepoPath           = paths.RepoPath;
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
        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];
        }
Exemplo n.º 8
0
    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);
    }
Exemplo n.º 9
0
    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);
    }
Exemplo n.º 10
0
 public LocalRepoReleaseProfileJsonParser(IFileSystem fileSystem, IResourcePaths paths)
 {
     _fileSystem = fileSystem;
     _paths      = paths;
 }
Exemplo n.º 11
0
 public VoicePathSource(IResourcePaths resourcePaths)
 {
     this.resourcePaths = resourcePaths;
 }
 public LocalRepoCustomFormatJsonParser(IFileSystem fileSystem, IResourcePaths paths)
 {
     _fileSystem = fileSystem;
     _paths      = paths;
 }
Exemplo n.º 13
0
 public void Get_custom_format_json_works(
     [Frozen] IResourcePaths paths,
     [Frozen(Matching.ImplementedInterfaces)] MockFileSystem fileSystem,
     LocalRepoReleaseProfileJsonParser sut)
 {
Exemplo n.º 14
0
 public VoicePreprocessor(IResourcePaths resourcePaths)
 {
     this.resourcePaths = resourcePaths;
 }