Ejemplo n.º 1
0
        public async Task PatcherOutputReported()
        {
            using var tmpFolder  = Utility.GetTempFolder();
            using var dataFolder = Utility.SetupDataFolder(tmpFolder, GameRelease.Oblivion);
            var output   = Utility.TypicalOutputFile(tmpFolder);
            var patcher  = new DummyPatcher();
            var reporter = new TrackerReporter();
            await Runner.Run(
                workingDirectory : tmpFolder.Dir.Path,
                outputPath : output,
                dataFolder : dataFolder.Dir.Path,
                release : GameRelease.Oblivion,
                loadOrder : Utility.TypicalLoadOrder(GameRelease.Oblivion, dataFolder.Dir),
                patchers : patcher.AsEnumerable().ToList(),
                reporter : reporter,
                cancel : CancellationToken.None);

            Assert.True(File.Exists(output));
            Assert.True(patcher.WasPrepped);
            Assert.True(patcher.WasRun);
            Assert.True(reporter.Success);
            Assert.True(reporter.PatcherComplete.Count > 0);
            Assert.NotEqual(output.Path, reporter.PatcherComplete[0].OutputPath);
            Assert.True(File.Exists(reporter.PatcherComplete[0].OutputPath));
        }
Ejemplo n.º 2
0
        public async Task TrimsAtypicalOutputFromLoadOrder()
        {
            using var tmpFolder  = Utility.GetTempFolder();
            using var dataFolder = Utility.SetupDataFolder(tmpFolder, GameRelease.SkyrimLE);
            ModKey atypicalKey = ModKey.FromNameAndExtension("Atypical.esp");
            var    output      = Path.Combine(tmpFolder.Dir.Path, atypicalKey.FileName);
            var    patcher     = new DummyPatcher();
            await Runner.Run(
                workingDirectory : tmpFolder.Dir.Path,
                outputPath : output,
                dataFolder : dataFolder.Dir.Path,
                release : GameRelease.SkyrimLE,
                loadOrder : Utility.TypicalLoadOrder(GameRelease.SkyrimLE, dataFolder.Dir)
                .And(new LoadOrderListing(Constants.SynthesisModKey, true))
                .And(new LoadOrderListing(atypicalKey, true))
                .And(new LoadOrderListing(Utility.RandomModKey, true)),
                patchers : patcher.AsEnumerable().ToList(),
                cancel : CancellationToken.None);

            Assert.Equal(
                new string[]
            {
                Utility.TestModKey.FileName,
                Utility.OverrideModKey.FileName,
                Constants.SynthesisModKey.FileName,
            }, File.ReadAllLines(Path.Combine(tmpFolder.Dir.Path, "Plugins.txt")));
        }
Ejemplo n.º 3
0
        public async Task PatcherThrowInRun()
        {
            using var tmpFolder  = Utility.GetTempFolder();
            using var dataFolder = Utility.SetupDataFolder(tmpFolder, GameRelease.Oblivion);
            var output  = Utility.TypicalOutputFile(tmpFolder);
            var patcher = new DummyPatcher()
            {
                ThrowInRun = true,
            };
            var reporter = new TrackerReporter();
            await Runner.Run(
                workingDirectory : tmpFolder.Dir.Path,
                outputPath : output,
                dataFolder : dataFolder.Dir.Path,
                release : GameRelease.Oblivion,
                loadOrder : Utility.TypicalLoadOrder(GameRelease.Oblivion, dataFolder.Dir),
                patchers : patcher.AsEnumerable().ToList(),
                reporter : reporter,
                cancel : CancellationToken.None);

            Assert.False(File.Exists(output));
            Assert.True(patcher.WasPrepped);
            Assert.True(patcher.WasRun);
            Assert.Equal(0, reporter.PrepProblems.Count);
            Assert.IsType <NotImplementedException>(reporter.RunProblem?.Exception);
            Assert.False(reporter.Success);
        }
Ejemplo n.º 4
0
        public async Task FinalOutputFileCreated()
        {
            using var tmpFolder  = Utility.GetTempFolder();
            using var dataFolder = Utility.SetupDataFolder(tmpFolder, GameRelease.Oblivion);
            var output  = Utility.TypicalOutputFile(tmpFolder);
            var patcher = new DummyPatcher();
            await Runner.Run(
                workingDirectory : tmpFolder.Dir.Path,
                outputPath : output,
                dataFolder : dataFolder.Dir.Path,
                release : GameRelease.Oblivion,
                loadOrder : Utility.TypicalLoadOrder(GameRelease.Oblivion, dataFolder.Dir),
                patchers : patcher.AsEnumerable().ToList());

            Assert.True(File.Exists(output));
        }
Ejemplo n.º 5
0
        public async Task BasicPatcherFunctionsCalled()
        {
            using var tmpFolder  = Utility.GetTempFolder();
            using var dataFolder = Utility.SetupDataFolder(tmpFolder, GameRelease.Oblivion);
            var output  = Utility.TypicalOutputFile(tmpFolder);
            var patcher = new DummyPatcher();
            await Runner.Run(
                workingDirectory : tmpFolder.Dir.Path,
                outputPath : output,
                dataFolder : dataFolder.Dir.Path,
                loadOrder : Utility.TypicalLoadOrder(GameRelease.Oblivion, dataFolder.Dir),
                release : GameRelease.Oblivion,
                patchers : patcher.AsEnumerable().ToList());

            Assert.True(patcher.WasRun);
            Assert.True(patcher.WasPrepped);
        }
Ejemplo n.º 6
0
        public async Task ListedNonExistantSourcePath()
        {
            using var tmpFolder  = Utility.GetTempFolder();
            using var dataFolder = Utility.SetupDataFolder(tmpFolder, GameRelease.Oblivion);
            var patcher  = new DummyPatcher();
            var output   = Utility.TypicalOutputFile(tmpFolder);
            var reporter = new TrackerReporter();
            await Runner.Run(
                workingDirectory : tmpFolder.Dir.Path,
                outputPath : output,
                dataFolder : dataFolder.Dir.Path,
                release : GameRelease.Oblivion,
                loadOrder : Utility.TypicalLoadOrder(GameRelease.Oblivion, dataFolder.Dir),
                sourcePath : output,
                reporter : reporter,
                patchers : patcher.AsEnumerable().ToList());

            Assert.False(patcher.WasPrepped);
            Assert.IsType <FileNotFoundException>(reporter.Overall);
            Assert.False(reporter.Success);
        }
Ejemplo n.º 7
0
        public async Task ChecksIfPatchersOutput()
        {
            using var tmpFolder  = Utility.GetTempFolder();
            using var dataFolder = Utility.SetupDataFolder(tmpFolder, GameRelease.Oblivion);
            var output  = Utility.TypicalOutputFile(tmpFolder);
            var patcher = new DummyPatcher()
            {
                DoWork = false,
            };
            var reporter = new TrackerReporter();
            await Runner.Run(
                workingDirectory : tmpFolder.Dir.Path,
                outputPath : output,
                dataFolder : dataFolder.Dir.Path,
                release : GameRelease.Oblivion,
                loadOrder : Utility.TypicalLoadOrder(GameRelease.Oblivion, dataFolder.Dir),
                reporter : reporter,
                patchers : patcher.AsEnumerable().ToList());

            Assert.IsType <ArgumentException>(reporter.RunProblem?.Exception);
            Assert.False(reporter.Success);
        }