Пример #1
0
        public void DefaultValuesTest()
        {
            AtomCategoriesMetadata categories = new AtomCategoriesMetadata();

            this.Assert.IsNull(categories.Fixed, "Expected null default value for property 'Fixed'.");
            this.Assert.IsNull(categories.Scheme, "Expected null default value for property 'Scheme'.");
            this.Assert.IsNull(categories.Href, "Expected null default value for property 'HRef'.");
            this.Assert.IsNull(categories.Categories, "Expected null default value for property 'Categories'.");
        }
        /// <summary>
        /// Visits an ATOM categories metadata.
        /// </summary>
        /// <param name="atomCategoriesMetadata">The categories metadata to visit.</param>
        protected virtual void VisitAtomCategoriesMetadata(AtomCategoriesMetadata atomCategoriesMetadata)
        {
            IEnumerable <AtomCategoryMetadata> categories = atomCategoriesMetadata.Categories;

            if (categories != null)
            {
                foreach (AtomCategoryMetadata category in categories)
                {
                    this.VisitAtomMetadata(category);
                }
            }
        }
Пример #3
0
        public void PropertySettersNullTest()
        {
            AtomCategoriesMetadata categories = new AtomCategoriesMetadata()
            {
                Fixed      = null,
                Scheme     = null,
                Href       = null,
                Categories = null,
            };

            this.Assert.IsNull(categories.Fixed, "Expected null value for property 'Fixed'.");
            this.Assert.IsNull(categories.Scheme, "Expected null value for property 'Scheme'.");
            this.Assert.IsNull(categories.Href, "Expected null value for property 'Href'.");
            this.Assert.IsNull(categories.Categories, "Expected null value for property 'Categories'.");
        }
        public void PropertyGettersAndSettersTest()
        {
            AtomTextConstruct      title      = new AtomTextConstruct();
            string                 accept     = "mime/type";
            AtomCategoriesMetadata categories = new AtomCategoriesMetadata();

            AtomResourceCollectionMetadata resourceCollection = new AtomResourceCollectionMetadata()
            {
                Title      = title,
                Accept     = accept,
                Categories = categories
            };

            this.Assert.AreSame(title, resourceCollection.Title, "Expected reference equal values for property 'Title'.");
            this.Assert.AreSame(accept, resourceCollection.Accept, "Expected reference equal values for property 'Accept'.");
            this.Assert.AreSame(categories, resourceCollection.Categories, "Expected reference equal values for property 'Categories'.");
        }
Пример #5
0
        public void PropertyGettersAndSettersTest()
        {
            bool   fixedValue = true;
            string scheme     = "http://odatalib.org/scheme";
            Uri    href       = new Uri("http://odatalib.org/href");
            List <AtomCategoryMetadata> categoriesList = new List <AtomCategoryMetadata> {
                new AtomCategoryMetadata()
            };

            AtomCategoriesMetadata categories = new AtomCategoriesMetadata()
            {
                Fixed      = fixedValue,
                Scheme     = scheme,
                Href       = href,
                Categories = categoriesList
            };

            this.Assert.AreEqual(fixedValue, categories.Fixed, "Expected equal values for property 'Fixed'.");
            this.Assert.AreSame(scheme, categories.Scheme, "Expected reference equal values for property 'Scheme'.");
            this.Assert.AreSame(href, categories.Href, "Expected reference equal values for property 'HRef'.");
            this.Assert.AreSame(categoriesList, categories.Categories, "Expected reference equal values for property 'Categories'.");
        }
        /// <summary>
        /// Visits an ATOM metadata object.
        /// </summary>
        /// <param name="atomMetadata"></param>
        protected virtual void VisitAtomMetadata(object atomMetadata)
        {
            if (atomMetadata == null)
            {
                return;
            }

            AtomCategoryMetadata atomCategoryMetadata = atomMetadata as AtomCategoryMetadata;

            if (atomCategoryMetadata != null)
            {
                this.VisitAtomCategoryMetadata(atomCategoryMetadata);
                return;
            }

            AtomEntryMetadata atomEntryMetadata = atomMetadata as AtomEntryMetadata;

            if (atomEntryMetadata != null)
            {
                this.VisitAtomEntryMetadata(atomEntryMetadata);
                return;
            }

            AtomFeedMetadata atomFeedMetadata = atomMetadata as AtomFeedMetadata;

            if (atomFeedMetadata != null)
            {
                this.VisitAtomFeedMetadata(atomFeedMetadata);
                return;
            }

            AtomGeneratorMetadata atomGeneratorMetadata = atomMetadata as AtomGeneratorMetadata;

            if (atomGeneratorMetadata != null)
            {
                this.VisitAtomGeneratorMetadata(atomGeneratorMetadata);
                return;
            }

            AtomLinkMetadata atomLinkMetadata = atomMetadata as AtomLinkMetadata;

            if (atomLinkMetadata != null)
            {
                this.VisitAtomLinkMetadata(atomLinkMetadata);
                return;
            }

            AtomPersonMetadata atomPersonMetadata = atomMetadata as AtomPersonMetadata;

            if (atomPersonMetadata != null)
            {
                this.VisitAtomPersonMetadata(atomPersonMetadata);
                return;
            }

            AtomResourceCollectionMetadata atomResourceCollectionMetadata = atomMetadata as AtomResourceCollectionMetadata;

            if (atomResourceCollectionMetadata != null)
            {
                this.VisitAtomResourceCollectionMetadata(atomResourceCollectionMetadata);
                return;
            }

            AtomStreamReferenceMetadata atomStreamReferenceMetadata = atomMetadata as AtomStreamReferenceMetadata;

            if (atomStreamReferenceMetadata != null)
            {
                this.VisitAtomStreamReferenceMetadata(atomStreamReferenceMetadata);
                return;
            }

            AtomTextConstruct atomTextConstruct = atomMetadata as AtomTextConstruct;

            if (atomTextConstruct != null)
            {
                this.VisitAtomTextConstruct(atomTextConstruct);
                return;
            }

            AtomWorkspaceMetadata atomWorkspaceMetadata = atomMetadata as AtomWorkspaceMetadata;

            if (atomWorkspaceMetadata != null)
            {
                this.VisitAtomWorkspaceMetadata(atomWorkspaceMetadata);
                return;
            }

            AtomCategoriesMetadata atomCategoriesMetadata = atomMetadata as AtomCategoriesMetadata;

            if (atomCategoriesMetadata != null)
            {
                this.VisitAtomCategoriesMetadata(atomCategoriesMetadata);
                return;
            }

            ExceptionUtilities.Assert(false, "Unrecognized ATOM metadata object {0} of type {1}.", atomMetadata.ToString(), atomMetadata.GetType().ToString());
        }
Пример #7
0
 /// <summary>
 /// Visits an ATOM categories metadata.
 /// </summary>
 /// <param name="atomCategoriesMetadata">The categories metadata to visit.</param>
 protected override void VisitAtomCategoriesMetadata(AtomCategoriesMetadata atomCategoriesMetadata)
 {
     this.ValidateEnumerable <AtomCategoryMetadata>(atomCategoriesMetadata.Categories, "AtomCategoriesMetadata.Categories");
     base.VisitAtomCategoriesMetadata(atomCategoriesMetadata);
 }
Пример #8
0
 /// <summary>
 /// Visits an ATOM categories metadata.
 /// </summary>
 /// <param name="atomCategoriesMetadata">The categories metadata to visit.</param>
 protected override void VisitAtomCategoriesMetadata(AtomCategoriesMetadata atomCategoriesMetadata)
 {
     this.ValidateUri(atomCategoriesMetadata.Href);
     base.VisitAtomCategoriesMetadata(atomCategoriesMetadata);
 }