Esempio n. 1
0
        public void alwaysEqualsInstanceOfSameClassWithSameUriRef()
        {
            UriRef instance = new UriRef("http://example.com/subject");
            UriRef other    = new UriRef("http://example.com/subject");

            Assert.IsTrue(instance.Equals(other));
        }
Esempio n. 2
0
        public void neverEqualsInstanceOfSameClassButDifferentUriRef()
        {
            UriRef instance = new UriRef("http://example.com/subject");
            UriRef other    = new UriRef("http://example.com/other");

            Assert.IsFalse(instance.Equals(other));
        }
Esempio n. 3
0
        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;
                }
            }
        }
Esempio n. 5
0
        public void alwaysEqualsSelf()
        {
            UriRef instance = new UriRef("http://example.com/subject");

            Assert.IsTrue(instance.Equals(instance));
        }
Esempio n. 6
0
        public void neverEqualsNull()
        {
            UriRef instance = new UriRef("http://example.com/subject");

            Assert.IsFalse(instance.Equals(null));
        }