Пример #1
0
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
        /// <exception cref="ArgumentException">The <paramref name="obj"/> is not the expected <see cref="Type"/>.</exception>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            CreativeCommonsSyndicationExtension value = obj as CreativeCommonsSyndicationExtension;

            if (value != null)
            {
                int result = String.Compare(this.Description, value.Description, StringComparison.OrdinalIgnoreCase);
                result = result | Uri.Compare(this.Documentation, value.Documentation, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase);
                result = result | String.Compare(this.Name, value.Name, StringComparison.OrdinalIgnoreCase);
                result = result | this.Version.CompareTo(value.Version);
                result = result | String.Compare(this.XmlNamespace, value.XmlNamespace, StringComparison.Ordinal);
                result = result | String.Compare(this.XmlPrefix, value.XmlPrefix, StringComparison.Ordinal);

                result = result | ComparisonUtility.CompareSequence(this.Context.Licenses, value.Context.Licenses, StringComparison.OrdinalIgnoreCase);

                return(result);
            }
            else
            {
                throw new ArgumentException(String.Format(null, "obj is not of type {0}, type was found to be '{1}'.", this.GetType().FullName, obj.GetType().FullName), "obj");
            }
        }
 private CreativeCommonsSyndicationExtension CreateExtension2()
 {
     var nyc = new CreativeCommonsSyndicationExtension();
     nyc.Context.Licenses.Add(new Uri("http://www.example.net/license1.html"));
     nyc.Context.Licenses.Add(new Uri("http://www.example.net/license2.html"));
     return nyc;
 }
 public void CreativeCommonsSyndicationExtensionConstructorTest()
 {
     CreativeCommonsSyndicationExtension target = new CreativeCommonsSyndicationExtension();
     Assert.IsNotNull(target);
     Assert.IsInstanceOfType(target, typeof(CreativeCommonsSyndicationExtension));
 }
        public void CreativeCommons_LoadTest()
        {
            CreativeCommonsSyndicationExtension target = new CreativeCommonsSyndicationExtension(); // TODO: Initialize to an appropriate value
            var nt = new NameTable();
            var ns = new XmlNamespaceManager(nt);
             var xpc = new XmlParserContext(nt, ns, "US-en",XmlSpace.Default);
             var strXml = ExtensionTestUtil.GetWrappedXml(namespc, strExtXml);

            using (XmlReader reader = new XmlTextReader(strXml, XmlNodeType.Document, xpc)	)
            {
            #if false
                //var document  = new XPathDocument(reader);
                //var nav = document.CreateNavigator();
                //nav.Select("//item");
                do
                {
                    if (!reader.Read())
                        break;
                } while (reader.NodeType != XmlNodeType.EndElement || reader.Name != "webMaster");

                bool expected = true;
                bool actual;
                actual = target.Load(reader);
                Assert.AreEqual(expected, actual);
            #else
                RssFeed feed = new RssFeed();
                feed.Load(reader);
            #endif
            }
        }