コード例 #1
0
        public void Given_Passing_ResolvedTargetingPacks_It_Passes_Again_With_Cached_Results()
        {
            ResolveTargetingPackAssets task1 = InitializeMockTargetingPackAssetsDirectory(out string packageDirectory);

            // Save off that build engine to inspect and reuse
            MockBuildEngine4 buildEngine = (MockBuildEngine4)task1.BuildEngine;

            task1.Execute().Should().BeTrue();

            buildEngine.RegisteredTaskObjectsQueries.Should().Be(2,
                                                                 because: "there should be a lookup for the overall and the specific targeting pack");

            buildEngine.RegisteredTaskObjects.Count.Should().Be(2,
                                                                because: "there should be a cache entry for the overall lookup and for the specific targeting pack");

            ResolveTargetingPackAssets task2 = InitializeTask(packageDirectory, buildEngine);

            task2.Execute().Should().BeTrue();

            buildEngine.RegisteredTaskObjectsQueries.Should().Be(3,
                                                                 because: "there should be a hit on the overall lookup this time through");

            buildEngine.RegisteredTaskObjects.Count.Should().Be(2,
                                                                because: "the cache keys should match");
        }
コード例 #2
0
        public void Given_Passing_ResolvedTargetingPacks_A_Different_Language_Parses_Again()
        {
            ResolveTargetingPackAssets task1 = InitializeMockTargetingPackAssetsDirectory(out string packageDirectory);

            // Save off that build engine to inspect and reuse
            MockBuildEngine4 buildEngine = (MockBuildEngine4)task1.BuildEngine;

            task1.Execute().Should().BeTrue();

            buildEngine.RegisteredTaskObjectsQueries.Should().Be(2,
                                                                 because: "there should be a lookup for the overall and the specific targeting pack");

            buildEngine.RegisteredTaskObjects.Count.Should().Be(2,
                                                                because: "there should be a cache entry for the overall lookup and for the specific targeting pack");

            ResolveTargetingPackAssets task2 = InitializeTask(packageDirectory, buildEngine);

            task2.ProjectLanguage = "F#";

            task2.Execute().Should().BeTrue();

            buildEngine.RegisteredTaskObjectsQueries.Should().Be(4,
                                                                 because: "there should be no hits on the overall or targeting pack lookup this time through");

            buildEngine.RegisteredTaskObjects.Count.Should().Be(4,
                                                                because: "there should be distinct results for C# and F#");
        }