public void alwaysEqualsInstanceOfSameClassWithSameUriRef() { UriRef instance = new UriRef("http://example.com/subject"); UriRef other = new UriRef("http://example.com/subject"); Assert.IsTrue(instance.Equals(other)); }
public void neverEqualsInstanceOfSameClassButDifferentUriRef() { UriRef instance = new UriRef("http://example.com/subject"); UriRef other = new UriRef("http://example.com/other"); Assert.IsFalse(instance.Equals(other)); }
public void neverEqualsInstanceOfDifferentClass() { UriRef instance = new UriRef("http://example.com/subject"); Object obj = new Object(); Assert.IsFalse(instance.Equals(obj)); }
/// <remarks> /// It is important to return UriRefs for correct equality comparision of URIs with fragment identifiers. /// </remarks> IEnumerable <UriRef> FetchUris(int offset, int limit) { String queryString = SparqlSerializer.SerializeFetchUris(_model, _query, offset, limit); SparqlQuery query = new SparqlQuery(queryString) { IsInferenceEnabled = _query.IsInferenceEnabled }; using (DataTable queryResults = _store.ExecuteQuery(_store.CreateQuery(query), _transaction)) { IEnumerable <BindingSet> bindings = GenerateBindings(queryResults); UriRef previousUri = null; foreach (BindingSet binding in bindings) { UriRef currentUri = binding[_query.GetGlobalScopeVariableNames()[0]] as UriRef; if (currentUri == null) { continue; } if (!currentUri.Equals(previousUri)) { yield return(currentUri); } previousUri = currentUri; } } }
public void alwaysEqualsSelf() { UriRef instance = new UriRef("http://example.com/subject"); Assert.IsTrue(instance.Equals(instance)); }
public void neverEqualsNull() { UriRef instance = new UriRef("http://example.com/subject"); Assert.IsFalse(instance.Equals(null)); }