Exemplo n.º 1
0
        public void FormLink_LoadOrder_ResolveAllContexts_DoubleQuery(LinkCacheTestTypes cacheType, AContextRetriever contextRetriever)
        {
            var mod         = new SkyrimMod(TestConstants.PluginModKey, SkyrimRelease.SkyrimLE);
            var npc         = mod.Npcs.AddNew();
            var mod2        = new SkyrimMod(TestConstants.PluginModKey3, SkyrimRelease.SkyrimLE);
            var npcOverride = mod2.Npcs.GetOrAddAsOverride(npc);

            npcOverride.FaceParts = new NpcFaceParts();
            var loadOrder = new LoadOrder <ISkyrimModGetter>()
            {
                mod,
                new SkyrimMod(TestConstants.PluginModKey2, SkyrimRelease.SkyrimLE),
                mod2
            };

            var(style, package) = GetLinkCache(loadOrder, cacheType);
            var formLink = new FormLink <INpcGetter>(npc.FormKey);
            var resolved = contextRetriever.ResolveAllContexts <INpc, INpcGetter>(formLink, package).ToArray();

            resolved = contextRetriever.ResolveAllContexts <INpc, INpcGetter>(formLink, package).ToArray();
            resolved.Should().HaveCount(2);
            resolved.First().Record.Should().BeSameAs(npcOverride);
            resolved.First().ModKey.Should().Be(TestConstants.PluginModKey3);
            resolved.First().Parent.Should().BeNull();
            resolved.Last().Record.Should().BeSameAs(npc);
            resolved.Last().ModKey.Should().Be(TestConstants.PluginModKey);
            resolved.Last().Parent.Should().BeNull();
        }
Exemplo n.º 2
0
        public void FormLink_Direct_ResolveAllContexts_Typed_Empty(LinkCacheTestTypes cacheType, AContextRetriever contextRetriever)
        {
            var formLink = new FormLink <IPlacedGetter>(UnusedFormKey);

            var(style, package) = GetLinkCache(new SkyrimMod(TestConstants.PluginModKey, SkyrimRelease.SkyrimLE), cacheType);
            WrapPotentialThrow(cacheType, style, () =>
            {
                contextRetriever.ResolveAllContexts <IPlacedGetter, IPlacedNpc, IPlacedNpcGetter>(formLink, package).Should().BeEmpty();
            });
        }
Exemplo n.º 3
0
        public void FormLink_Direct_ResolveAllContexts_Linked(LinkCacheTestTypes cacheType, AContextRetriever contextRetriever)
        {
            var mod = new SkyrimMod(TestConstants.PluginModKey, SkyrimRelease.SkyrimLE);
            var npc = mod.Npcs.AddNew();

            var(style, package) = GetLinkCache(mod, cacheType);
            var formLink = new FormLink <INpcGetter>(npc.FormKey);

            WrapPotentialThrow(cacheType, style, () =>
            {
                var resolved = contextRetriever.ResolveAllContexts <INpc, INpcGetter>(formLink, package).ToArray();
                resolved.Should().HaveCount(1);
                resolved.First().Record.Should().BeSameAs(npc);
                resolved.First().ModKey.Should().Be(TestConstants.PluginModKey);
                resolved.First().Parent.Should().BeNull();
            });
        }