Ejemplo n.º 1
0
 public static PassthroughTest Factory(TestingSettings settings, TargetGroup group, Target target)
 {
     return(Factory(new PassthroughTestParams()
     {
         NicknameSuffix = group.NicknameSuffix,
         PassthroughSettings = settings.PassthroughSettings,
         Target = target,
         GameRelease = group.GameRelease,
     }));
 }
Ejemplo n.º 2
0
        //public static async Task BaseGroupIterator(Target settings, DataFolderLocations locs)
        //{
        //    if (!settings.ExpectedBaseGroupCount.TryGet(out var expected)) return;
        //    var loc = settings.GetFilePath(locs);
        //    using var stream = new MutagenBinaryReadStream(loc.Path, settings.GameRelease);
        //    var grups = RecordLocator.IterateBaseGroupLocations(stream).ToArray();
        //    Assert.Equal(expected, grups.Length);
        //}

        public static async Task RecordEnumerations(TestingSettings settings, Target target)
        {
            var mod = OblivionMod.CreateFromBinaryOverlay(
                Path.Combine(settings.DataFolderLocations.Oblivion, target.Path));
            var set1 = new HashSet <FormKey>(mod.EnumerateMajorRecords().Select(m => m.FormKey));
            var set2 = new HashSet <FormKey>(mod.EnumerateMajorRecords <IMajorRecordCommonGetter>().Select(m => m.FormKey));

            set1.Count.Should().Equals(set2.Count);
            set1.Should().Equals(set2);
        }
Ejemplo n.º 3
0
        public static async Task RunTests(TestingSettings settings)
        {
            int passed = 0;
            int failed = 0;

            await foreach (var test in GetTests(settings: settings))
            {
                using var sub = test.AllOutput.Subscribe(msg =>
                {
                    System.Console.WriteLine(msg);
                });
                try
                {
                    await test.Start();

                    passed += 1 + test.ChildCount;
                }
                catch (Exception ex)
                {
                    failed += 1 + test.ChildCount;
                    if (ex is IPrintable printable)
                    {
                        FileGeneration fg = new FileGeneration();
                        printable.ToString(fg);
                        var str = fg.ToString();
                        System.Console.Write(fg);
                        System.Console.WriteLine();
                    }
                    else
                    {
                        System.Console.WriteLine(ex);
                    }
                }
                await test.Output.LastOrDefaultAsync();

                GC.Collect();
            }
            if (failed == 0)
            {
                System.Console.WriteLine("All passed");
            }
            else
            {
                System.Console.WriteLine($"{failed} / {(passed + failed)} failed");
            }
        }
Ejemplo n.º 4
0
        public static async Task Oblivion_FlattenMod(TestingSettings testingSettings)
        {
            List <ModListing> loadOrderListing = new List <ModListing>()
            {
                new ModKey("Oblivion", ModType.Master),
                new ModKey("Knights", ModType.Plugin)
            };
            var loadOrder = LoadOrder.Import <OblivionMod>(
                dataFolder: testingSettings.DataFolderLocations.Oblivion,
                loadOrder: loadOrderListing,
                gameRelease: GameRelease.Oblivion);
            OblivionMod ret = new OblivionMod(new ModKey("Test", ModType.Plugin));

            foreach (var listing in loadOrder.ListedOrder)
            {
                ret.Npcs.RecordCache.Set(listing.Mod.Npcs.Records);
            }
        }