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.ScanLocalFilesAsync(null, new ProgressMock <ScanLocalFilesProgress>());

            PartyAssertions.AreDeepEqual(
                TestFactory.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
                );
        }
        public async Task CanListScriptsAsync()
        {
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { @"C:\VaM\Custom\Scripts\Script 1.cs", new MockFileData("using Unity;\npublic class MyScript {}") },
            });
            var handler = Create(fileSystem);

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

            PartyAssertions.AreDeepEqual(
                TestFactory.SavesMap()
                .WithScript(new LocalScriptFile(@"C:\VaM\Custom\Scripts\Script 1.cs", "90A449A3FC7A01DCF27C92090C05804BFF1EC887006A77F71E984D21F7B38CD4"), out var _)
                .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 async Task CanListScriptListsAsync()
        {
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { @"C:\VaM\Custom\Scripts\My Script\Script 1.cs", new MockFileData("using Unity;\npublic class MyScript {}") },
                { @"C:\VaM\Custom\Scripts\My Script\Add Me.cslist", new MockFileData("Script 1.cs") },
            });
            var handler = Create(fileSystem);

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

            PartyAssertions.AreDeepEqual(
                TestFactory.SavesMap()
                .WithScript(new LocalScriptListFile(@"C:\VaM\Custom\Scripts\My Script\Add Me.cslist", "3258C0B1D41C29CBC98B475EEEB5BF7609C9B4F290168A0E2158253DF044F325", new[] {
                new LocalScriptFile(@"C:\VaM\Custom\Scripts\My Script\Script 1.cs", "90A449A3FC7A01DCF27C92090C05804BFF1EC887006A77F71E984D21F7B38CD4")
            }), out var _)
                .Build(),
                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);
        }