public void When_a_package_is_deleted_Then_its_validation_issues_should_be_removed()
        {
            Package newBLibrary = ABLibraryWithOneIssue("BLibrary2", bLibrary);

            validatingCCRepository.LoadPackageByID(newBLibrary.PackageID);
            issueHandler.AssertReceivedIssuesTotal(1);
            issueHandler.AssertReceivedIssues(1, newBLibrary.PackageID, newBLibrary.PackageID);

            validatingCCRepository.ItemDeleted(ItemId.ForPackage(newBLibrary.PackageID));
            issueHandler.AssertReceivedIssuesTotal(0);
        }
        public void When_a_package_is_deleted_Then_its_parent_package_should_be_validated()
        {
            Package subPackage = bLibrary.AddPackage("Package 1.1", package_1_1 => { package_1_1.Element.Stereotype = "other package"; });

            validatingCCRepository.LoadPackageByID(subPackage.PackageID);
            issueHandler.AssertReceivedIssuesTotal(1);
            issueHandler.AssertReceivedIssues(1, bLibrary.PackageID, subPackage.PackageID);

            validatingCCRepository.ItemDeleted(ItemId.ForPackage(subPackage.PackageID));
            issueHandler.AssertReceivedIssuesTotal(0);
        }
        public void When_a_package_is_deleted_Then_the_package_should_no_longer_be_in_the_repository()
        {
            Package newBLibrary = ABLibraryWithoutIssues("New BLibrary", bLibrary);

            validatingCCRepository.LoadPackageByID(newBLibrary.PackageID);

            validatingCCRepository.ItemDeleted(ItemId.ForPackage(newBLibrary.PackageID));
            var bLibraries = new List <IBLibrary>(validatingCCRepository.GetBLibraries());

            Assert.AreEqual(1, bLibraries.Count, "Wrong number of BLibraries");
            Assert.AreEqual(bLibrary.PackageID, bLibraries[0].Id);
        }
コード例 #4
0
        public void When_a_package_element_is_reloaded_Then_the_package_should_be_reloaded()
        {
            // this is a fix for the problem that sometimes (e.g. when changing a package's tagged values),
            // EA generates an event for the package's internal element to have changed instead of the package itself.
            contentLoader.LoadRepositoryContent();
            RepositoryItem loadedItem = null;

            contentLoader.ItemLoaded += itemData => loadedItem = itemData;
            bLibrary.Element.SetTaggedValue(TaggedValues.baseURN, "test");
            contentLoader.LoadElementByID(bLibrary.Element.ElementID);
            Assert.AreEqual(ItemId.ForPackage(bLibrary.PackageID), loadedItem.Id);
        }
        public void When_a_package_is_deleted_Then_its_descendants_validation_issues_should_be_removed()
        {
            Package bLibraryWithoutIssues = ABLibraryWithoutIssues("BLibrary2", bLibrary);
            Package aBLibraryWithOneIssue = ABLibraryWithOneIssue("BLibrary3", bLibraryWithoutIssues);

            validatingCCRepository.LoadPackageByID(bLibraryWithoutIssues.PackageID);
            validatingCCRepository.LoadPackageByID(aBLibraryWithOneIssue.PackageID);
            issueHandler.AssertReceivedIssuesTotal(1);
            issueHandler.AssertReceivedIssues(1, aBLibraryWithOneIssue.PackageID, aBLibraryWithOneIssue.PackageID);

            validatingCCRepository.ItemDeleted(ItemId.ForPackage(bLibraryWithoutIssues.PackageID));
            issueHandler.AssertReceivedIssuesTotal(0);
        }
コード例 #6
0
        public void When_an_item_with_an_unknown_parentId_is_loaded_Then_it_should_throw_an_ArgumentException()
        {
            var item = new RepositoryItemBuilder().WithItemType(ItemId.ItemType.Package).WithParent(new RepositoryItemBuilder().WithId(ItemId.ForPackage(2))).Build();

            repository.ItemLoaded(item);
        }
コード例 #7
0
        public void When_a_package_has_a_non_UPCC_stereotype_Then_return_null()
        {
            var repositoryItem = new RepositoryItemBuilder().WithParent(new RepositoryItemBuilder().WithId(ItemId.ForPackage(1)))
                                 .WithItemType(ItemId.ItemType.Package)
                                 .WithStereotype("foobar")
                                 .Build();
            object wrappedObject = CCItemWrapper.Wrap(repositoryItem);

            Assert.IsNull(wrappedObject, "Object with unknown stereotype not wrapped to null, but wrapped as " + (wrappedObject == null ? null : wrappedObject.GetType()));
        }
コード例 #8
0
        private static void AssertPackageWithStereotypeIsWrappedAs <TExpected>(string stereotype)
        {
            var parent         = new RepositoryItemBuilder().WithParent(new RepositoryItemBuilder().WithId(ItemId.ForPackage(1))).WithItemType(ItemId.ItemType.Package).Build();
            var repositoryItem = new RepositoryItemBuilder()
                                 .WithItemType(ItemId.ItemType.Package).WithParent(new RepositoryItemBuilder().WithId(parent.Id))
                                 .WithStereotype(stereotype)
                                 .Build();
            object wrappedObject = CCItemWrapper.Wrap(repositoryItem);

            Assert.IsNotNull(wrappedObject, "Wrapped object is null.");
            Assert.IsTrue(wrappedObject is TExpected, "\nWrapped object is not of expected type:\n  expected: " + typeof(TExpected) + "\n  but was:  " + wrappedObject.GetType());
        }