Esempio n. 1
0
        public void FormLink_Direct_ResolveContext_DeepRecord_NoLink(LinkCacheTestTypes cacheType, AContextRetriever contextRetriever)
        {
            var formLink = new FormLink <IPlacedNpcGetter>(UnusedFormKey);

            var(style, package) = GetLinkCache(new SkyrimMod(TestConstants.PluginModKey, SkyrimRelease.SkyrimLE), cacheType);
            WrapPotentialThrow(cacheType, style, () =>
            {
                Assert.Null(contextRetriever.ResolveContext <IPlacedNpc, IPlacedNpcGetter>(formLink, package));
            });
        }
Esempio n. 2
0
        public void FormLink_Direct_ResolveContext_MarkerInterface_NoLink(LinkCacheTestTypes cacheType, AContextRetriever contextRetriever)
        {
            var formLink = new FormLink <IEffectRecordGetter>(UnusedFormKey);

            var(style, package) = GetLinkCache(new SkyrimMod(TestConstants.PluginModKey, SkyrimRelease.SkyrimLE), cacheType);
            WrapPotentialThrow(cacheType, style, () =>
            {
                var resolved = contextRetriever.ResolveContext <IEffectRecord, IEffectRecordGetter>(formLink, package);
                Assert.Null(resolved);
            });
        }
Esempio n. 3
0
        public void FormLink_Direct_ResolveContext_MarkerInterface_DeepRecord_Linked(LinkCacheTestTypes cacheType, AContextRetriever contextRetriever)
        {
            var mod        = new SkyrimMod(TestConstants.PluginModKey, SkyrimRelease.SkyrimLE);
            var worldspace = mod.Worldspaces.AddNew();
            var subBlock   = new WorldspaceSubBlock();
            var cell       = new Cell(mod.GetNextFormKey(), SkyrimRelease.SkyrimLE);

            subBlock.Items.Add(cell);
            var placedNpc = new PlacedNpc(mod.GetNextFormKey(), SkyrimRelease.SkyrimLE);

            cell.Temporary.Add(placedNpc);
            var block = new WorldspaceBlock();

            block.Items.Add(subBlock);
            worldspace.SubCells.Add(block);
            var(style, package) = GetLinkCache(mod, cacheType);
            var placedFormLink = new FormLink <IPlacedGetter>(placedNpc.FormKey);

            WrapPotentialThrow(cacheType, style, () =>
            {
                var resolvedPlaced = contextRetriever.ResolveContext <IPlaced, IPlacedGetter>(placedFormLink, package);
                resolvedPlaced.Record.Should().BeSameAs(placedNpc);
                resolvedPlaced.ModKey.Should().Be(TestConstants.PluginModKey);
                resolvedPlaced.Parent.Record.Should().BeSameAs(cell);
                var cellFormLink = new FormLink <ICellGetter>(cell.FormKey);
                var resolvedCell = contextRetriever.ResolveContext <ICell, ICellGetter>(cellFormLink, package);
                resolvedCell.Record.Should().BeSameAs(cell);
                resolvedCell.ModKey.Should().Be(TestConstants.PluginModKey);
                resolvedCell.Parent.Record.Should().BeSameAs(subBlock);
                var worldspaceFormLink = new FormLink <IWorldspaceGetter>(worldspace.FormKey);
                var resolvedWorldspace = contextRetriever.ResolveContext <IWorldspace, IWorldspaceGetter>(worldspaceFormLink, package);
                resolvedWorldspace.Record.Should().BeSameAs(worldspace);
                resolvedWorldspace.ModKey.Should().Be(TestConstants.PluginModKey);
                resolvedWorldspace.Parent.Should().BeNull();
            });
        }
Esempio n. 4
0
        public void FormLink_Direct_ResolveContext_MarkerInterface(LinkCacheTestTypes cacheType, AContextRetriever contextRetriever)
        {
            var mod   = new SkyrimMod(TestConstants.PluginModKey, SkyrimRelease.SkyrimLE);
            var spell = mod.Spells.AddNew();

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

            WrapPotentialThrow(cacheType, style, () =>
            {
                var resolved = contextRetriever.ResolveContext <IEffectRecord, IEffectRecordGetter>(formLink, package);
                resolved.Record.Should().BeSameAs(spell);
                resolved.ModKey.Should().Be(TestConstants.PluginModKey);
                resolved.Parent.Should().BeNull();
            });
        }
Esempio n. 5
0
        public void FormLink_Direct_ResolveContext_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 resolvedNpc = contextRetriever.ResolveContext <INpc, INpcGetter>(formLink, package);
                resolvedNpc.Record.Should().BeSameAs(npc);
                resolvedNpc.ModKey.Should().Be(TestConstants.PluginModKey);
                resolvedNpc.Parent.Should().BeNull();
            });
        }