/// <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); } FeedRankSyndicationExtension value = obj as FeedRankSyndicationExtension; 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 | Uri.Compare(this.Context.Domain, value.Context.Domain, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase); result = result | String.Compare(this.Context.Label, value.Context.Label, StringComparison.Ordinal); result = result | Uri.Compare(this.Context.Scheme, value.Context.Scheme, UriComponents.AbsoluteUri, UriFormat.SafeUnescaped, StringComparison.Ordinal); result = result | this.Context.Value.CompareTo(value.Context.Value); 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"); } }
public void FeedRankSyndicationExtensionConstructorTest() { FeedRankSyndicationExtension target = new FeedRankSyndicationExtension(); Assert.IsNotNull(target); Assert.IsInstanceOfType(target, typeof(FeedRankSyndicationExtension)); }
private FeedRankSyndicationExtension CreateExtension2() { var re = new FeedRankSyndicationExtension(); re.Context.Domain = new Uri("http://example.net"); re.Context.Label = "label"; re.Context.Scheme = new Uri("http://example.net/scheme.html"); re.Context.Value = 2.0m; return re; }
private FeedRankSyndicationExtension CreateExtension1() { var re = new FeedRankSyndicationExtension(); re.Context.Domain = new Uri("http://example.com"); re.Context.Label = "Title"; re.Context.Scheme = new Uri("http://example.com/scheme.txt"); re.Context.Value = 1.0m; return re; }
public void FeedRank_LoadTest() { FeedRankSyndicationExtension target = new FeedRankSyndicationExtension(); // 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 } }