示例#1
0
            public void ShouldReturnTrueIfTheExtensionHasBeenRegisteredOnABaseClass()
            {
                KmlFactory.RegisterExtension <BaseElement, ManuallyRegisteredElement>();

                bool result = KmlFactory.IsKnownExtensionType(typeof(DerivedElement), typeof(ManuallyRegisteredElement));

                Assert.That(result, Is.True);
            }
示例#2
0
        /// <summary>
        /// Adds the specified element to this instance.
        /// </summary>
        /// <param name="child">The child to add.</param>
        /// <exception cref="ArgumentNullException">child is null.</exception>
        public void AddChild(Element child)
        {
            Check.IsNotNull(child, nameof(child));

            if (!KmlFactory.IsKnownExtensionType(this.GetType(), child.GetType()))
            {
                throw new ArgumentException("Element has not been registered as a valid child type.");
            }

            this.AddAsChild(this.orphans, child);
        }
示例#3
0
            public void ShouldReturnFalseIfTheExtensionIsNotRegistered()
            {
                bool result = KmlFactory.IsKnownExtensionType(typeof(DerivedElement), typeof(NotRegisteredElement));

                Assert.That(result, Is.False);
            }