public void NoConflicts()
        {
            var accessPointA = new MockAccessPoint {
                ID = "a"
            };
            var appEntry1 = new AppEntry
            {
                Name         = "App1", InterfaceUri = FeedTest.Test1Uri,
                AccessPoints = new AccessPointList {
                    Entries = { accessPointA }
                }
            };
            var accessPointB = new MockAccessPoint {
                ID = "b"
            };
            var appEntry2 = new AppEntry {
                Name = "App2", InterfaceUri = FeedTest.Test2Uri
            };

            var appList = new AppList {
                Entries = { appEntry1 }
            };

            appList.CheckForConflicts(new[] { accessPointB }, appEntry2);
        }
        public void TestRemoveAccessPoints()
        {
            var capabilityList = CapabilityListTest.CreateTestCapabilityList();
            var testApp        = new Feed {
                Name = "Test", CapabilityLists = { capabilityList }
            };

            using var unapplyFlag = new TemporaryFlagFile("0install-unit-tests");
            var accessPoint = new MockAccessPoint {
                ID = "id1", Capability = "my_ext1", UnapplyFlagPath = unapplyFlag
            };

            // Inject access point into AppEntry (without running integration)
            var appEntry = _integrationManager.AddApp(new FeedTarget(FeedTest.Test1Uri, testApp));

            appEntry.AccessPoints = new AccessPointList {
                Entries = { accessPoint }
            };

            _integrationManager.RemoveAccessPoints(appEntry, new[] { accessPoint });
            _integrationManager.AppList.Entries[0].AccessPoints !.Entries.Should().BeEmpty();

            unapplyFlag.Set.Should().BeTrue(because: "Unapply() should be called");

            _integrationManager.Invoking(x => x.RemoveAccessPoints(appEntry, new[] { accessPoint }))
            .Should().NotThrow(because: "Allow multiple removals of access points.");
        }
        public void ReApply()
        {
            var accessPointA = new MockAccessPoint {ID = "a"};
            var appEntry1 = new AppEntry
            {
                Name = "App1", InterfaceUri = FeedTest.Test1Uri,
                AccessPoints = new AccessPointList {Entries = {accessPointA}}
            };

            var appList = new AppList {Entries = {appEntry1}};
            appList.CheckForConflicts(new[] {accessPointA}, appEntry1);
        }
        public void Conflict()
        {
            var accessPointA = new MockAccessPoint {ID = "a"};
            var appEntry1 = new AppEntry
            {
                Name = "App1",
                InterfaceUri = FeedTest.Test1Uri,
                AccessPoints = new AccessPointList {Entries = {accessPointA}}
            };
            var appEntry2 = new AppEntry {Name = "App2", InterfaceUri = FeedTest.Test2Uri};

            var appList = new AppList {Entries = {appEntry1}};
            Assert.Throws<ConflictException>(() => appList.CheckForConflicts(new[] {accessPointA}, appEntry2));
        }
        public void Conflict()
        {
            var accessPointA = new MockAccessPoint {ID = "a"};
            var appEntry1 = new AppEntry
            {
                Name = "App1",
                InterfaceUri = FeedTest.Test1Uri,
                AccessPoints = new AccessPointList {Entries = {accessPointA}}
            };
            var appEntry2 = new AppEntry {Name = "App2", InterfaceUri = FeedTest.Test2Uri};

            var appList = new AppList {Entries = {appEntry1}};
            appList.Invoking(x => x.CheckForConflicts(new[] {accessPointA}, appEntry2))
                .ShouldThrow<ConflictException>();
        }
        public void Conflict()
        {
            var accessPointA = new MockAccessPoint {
                ID = "a"
            };
            var appEntry1 = new AppEntry
            {
                Name         = "App1",
                InterfaceUri = FeedTest.Test1Uri,
                AccessPoints = new AccessPointList {
                    Entries = { accessPointA }
                }
            };
            var appEntry2 = new AppEntry {
                Name = "App2", InterfaceUri = FeedTest.Test2Uri
            };

            var appList = new AppList {
                Entries = { appEntry1 }
            };

            Assert.Throws <ConflictException>(() => appList.CheckForConflicts(new[] { accessPointA }, appEntry2));
        }
예제 #7
0
        public void Conflict()
        {
            var accessPointA = new MockAccessPoint {
                ID = "a"
            };
            var appEntry1 = new AppEntry
            {
                Name         = "App1",
                InterfaceUri = FeedTest.Test1Uri,
                AccessPoints = new AccessPointList {
                    Entries = { accessPointA }
                }
            };
            var appEntry2 = new AppEntry {
                Name = "App2", InterfaceUri = FeedTest.Test2Uri
            };

            var appList = new AppList {
                Entries = { appEntry1 }
            };

            appList.Invoking(x => x.CheckForConflicts(new[] { accessPointA }, appEntry2))
            .ShouldThrow <ConflictException>();
        }
        public void TestRemoveAccessPoints()
        {
            var capabilityList = CapabilityListTest.CreateTestCapabilityList();
            var testApp = new Feed {Name = "Test", CapabilityLists = {capabilityList}};

            using (var unapplyFlag = new TemporaryFlagFile("0install-unit-tests"))
            {
                var accessPoint = new MockAccessPoint {ID = "id1", Capability = "my_ext1", UnapplyFlagPath = unapplyFlag};

                // Inject access point into AppEntry (without running integration)
                var appEntry = _integrationManager.AddApp(new FeedTarget(FeedTest.Test1Uri, testApp));
                appEntry.AccessPoints = new AccessPointList {Entries = {accessPoint}};

                _integrationManager.RemoveAccessPoints(appEntry, new[] {accessPoint});
                Assert.IsEmpty(_integrationManager.AppList.Entries[0].AccessPoints.Entries);

                Assert.IsTrue(unapplyFlag.Set, "Unapply() should be called");

                Assert.DoesNotThrow(() => _integrationManager.RemoveAccessPoints(appEntry, new[] {accessPoint}), "Allow multiple removals of access points.");
            }
        }