ZeroInstall.DesktopIntegration.IntegrationManagerTest.TestAddAccessPoints C# (CSharp) Method

TestAddAccessPoints() private method

private TestAddAccessPoints ( ) : void
return void
        public void TestAddAccessPoints()
        {
            var capabilityList = CapabilityListTest.CreateTestCapabilityList();
            var feed1 = new Feed {Name = "Test", CapabilityLists = {capabilityList}};
            var feed2 = new Feed {Name = "Test", CapabilityLists = {capabilityList}};
            using (var applyFlag1 = new TemporaryFlagFile("0install-unit-tests"))
            using (var applyFlag2 = new TemporaryFlagFile("0install-unit-tests"))
            {
                var accessPoints1 = new AccessPoint[] {new MockAccessPoint {ID = "id1", Capability = "my_ext1", ApplyFlagPath = applyFlag1}};
                var accessPoints2 = new AccessPoint[] {new MockAccessPoint {ID = "id2", Capability = "my_ext2", ApplyFlagPath = applyFlag2}};

                _integrationManager.AppList.Entries.Count.Should().Be(0);
                var appEntry1 = _integrationManager.AddApp(new FeedTarget(FeedTest.Test1Uri, feed1));
                _integrationManager.AddAccessPoints(appEntry1, feed1, accessPoints1);
                _integrationManager.AppList.Entries.Count.Should().Be(1, because: "Should implicitly create missing AppEntries");
                applyFlag1.Set.Should().BeTrue(because: "Should apply AccessPoint");
                applyFlag1.Set = false;

                _integrationManager.Invoking(x => x.AddAccessPoints(appEntry1, feed1, accessPoints1))
                    .ShouldNotThrow(because: "Duplicate access points should be silently reapplied");
                applyFlag1.Set.Should().BeTrue(because: "Duplicate access points should be silently reapplied");

                _integrationManager.AddAccessPoints(appEntry1, feed1, accessPoints2);
                applyFlag2.Set = false;

                var appEntry2 = _integrationManager.AddApp(new FeedTarget(FeedTest.Test2Uri, feed2));
                _integrationManager.Invoking(x => x.AddAccessPoints(appEntry2, feed2, accessPoints2))
                    .ShouldThrow<ConflictException>(because: "Should prevent access point conflicts");
                applyFlag2.Set.Should().BeFalse(because: "Should prevent access point conflicts");
            }
        }