Пример #1
0
        public async Task CanIgnoreByExtension()
        {
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { @"C:\VaM\Saves\Scene 1.exe", new MockFileData("I'm bad") },
            });
            var handler = Create(fileSystem);

            var result = await handler.AnalyzeSaves(null);

            PartyAssertions.AreDeepEqual(
                ResultFactory.SavesMap().Build(),
                result
                );
        }
Пример #2
0
        public async Task CanIgnoreByPath()
        {
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { @"C:\VaM\Saves\Ignored\Scene 1.json", new MockFileData("I don't count") },
            });
            var handler = Create(fileSystem, new[] { @"C:\VaM\Saves\Ignored" });

            var result = await handler.AnalyzeSaves(null);

            PartyAssertions.AreDeepEqual(
                ResultFactory.SavesMap().Build(),
                result
                );
        }
        public async Task CanIgnoreByExtension()
        {
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { @"C:\VaM\Saves\Scene 1.exe", new MockFileData("I'm bad") },
            });
            var handler = Create(fileSystem);

            var result = await handler.ScanLocalFilesAsync(null, new ProgressMock <ScanLocalFilesProgress>());

            PartyAssertions.AreDeepEqual(
                TestFactory.SavesMap().Build(),
                result
                );
        }
Пример #4
0
        public async Task CanListScenesAsync()
        {
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { @"C:\VaM\Saves\Scene 1.json", new MockFileData("{}") },
            });
            var handler = Create(fileSystem);

            var result = await handler.AnalyzeSaves(null);

            PartyAssertions.AreDeepEqual(
                ResultFactory.SavesMap()
                .WithScene(new Scene(@"C:\VaM\Saves\Scene 1.json"))
                .Build(),
                result
                );
        }
        public async Task CanListScenesAsync()
        {
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { @"C:\VaM\Saves\Scene 1.json", new MockFileData("{}") },
            });
            var handler = Create(fileSystem);

            var result = await handler.ScanLocalFilesAsync(null, new ProgressMock <ScanLocalFilesProgress>());

            PartyAssertions.AreDeepEqual(
                TestFactory.SavesMap()
                .WithScene(new LocalSceneFile(@"C:\VaM\Saves\Scene 1.json"))
                .Build(),
                result
                );
        }
        public void CanMatchNothing()
        {
            var saves = TestFactory.SavesMap()
                        .WithScript(new LocalScriptFile($"{_vam}1.cs", "1"), out var script1)
                        .Build();
            var registry = TestFactory.Reg(
                TestFactory.RegScript("my-script", TestFactory.RegVer("1.0.0", TestFactory.RegFile("2.cs", "2"))));

            var result = _handler.MatchLocalFilesToRegistry(saves, registry);

            PartyAssertions.AreDeepEqual(new RegistrySavesMatches
            {
                HashMatches     = new RegistrySavesMatch[0],
                FilenameMatches = new RegistrySavesMatch[0],
                NoMatches       = new[] { script1 }
            }, result);
        }
        public void DoesNotMatchByFilenameWhenMatchedByHash()
        {
            var saves = TestFactory.SavesMap()
                        .WithScript(new LocalScriptFile($"{_vam}1.cs", "1"), out var local1)
                        .Build();
            var file     = TestFactory.RegFile("1.cs", "1");
            var version  = TestFactory.RegVer("1.0.0", file);
            var package  = TestFactory.RegScript("my-script", version);
            var registry = TestFactory.Reg(package);

            var result = _handler.MatchLocalFilesToRegistry(saves, registry);

            PartyAssertions.AreDeepEqual(new RegistrySavesMatches
            {
                HashMatches = new[] { new RegistrySavesMatch {
                                          Remote = new RegistryPackageFileContext(registry, package, version, file), Local = local1
                                      } },
                FilenameMatches = new RegistrySavesMatch[0],
                NoMatches       = new LocalScriptFile[0]
            }, result);
        }
Пример #8
0
        public void DoesNotMatchByFilenameWhenMatchedByHash()
        {
            var saves = ResultFactory.SavesMap()
                        .WithScript(new Script($"{_vam}1.cs", "1"), out var local1)
                        .Build();
            RegistryFile           file    = ResultFactory.RegFile("1.cs", "1");
            RegistryPackageVersion version = ResultFactory.RegVer("1.0.0", file);
            RegistryPackage        script  = ResultFactory.RegScript("my-script", version);
            var registry = ResultFactory.Reg(script);

            var result = _handler.Match(saves, registry);

            PartyAssertions.AreDeepEqual(new RegistrySavesMatches
            {
                HashMatches = new[] { new RegistrySavesMatch {
                                          Script = script, Version = version, File = file, Local = local1
                                      } },
                FilenameMatches = new RegistrySavesMatch[0],
                NoMatches       = new Script[0]
            }, result);
        }