/// <summary>Only</summary>
        public virtual void TestNothing()
        {
            IQuery q = NewQuery();

            q.Descend("child");
            SodaTestUtil.Expect(q, _array);
        }
Esempio n. 2
0
        public virtual void TestEndsWith()
        {
            var q = NewQuery();

            q.Constrain(new STStringTestCase
                            ("do"));
            q.Descend("str").Constraints().EndsWith(true);
            Expect(q, new int[] {});
            q = NewQuery();
            q.Constrain(new STStringTestCase
                            ("od"));
            q.Descend("str").Constraints().EndsWith(true);
            SodaTestUtil.ExpectOne(q, new STStringTestCase
                                       ("dod"));
            q = NewQuery();
            q.Constrain(new STStringTestCase
                            ("D"));
            q.Descend("str").Constraints().EndsWith(false);
            SodaTestUtil.ExpectOne(q, new STStringTestCase
                                       ("dod"));
            q = NewQuery();
            q.Constrain(new STStringTestCase
                            ("dodo"));
            // COR-413
            q.Descend("str").Constraints().EndsWith(false);
            Expect(q, new int[] {});
        }
Esempio n. 3
0
        public virtual void TestEndsWith()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STStringTestCase
                            ("do"));
            q.Descend("str").Constraints().EndsWith(true);
            Expect(q, new int[] {  });
            q = NewQuery();
            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STStringTestCase
                            ("od"));
            q.Descend("str").Constraints().EndsWith(true);
            SodaTestUtil.ExpectOne(q, new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STStringTestCase
                                       ("dod"));
            q = NewQuery();
            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STStringTestCase
                            ("D"));
            q.Descend("str").Constraints().EndsWith(false);
            SodaTestUtil.ExpectOne(q, new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STStringTestCase
                                       ("dod"));
            q = NewQuery();
            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STStringTestCase
                            ("dodo"));
            // COR-413
            q.Descend("str").Constraints().EndsWith(false);
            Expect(q, new int[] {  });
        }
Esempio n. 4
0
        public virtual void TestEquals()
        {
            var q = NewQuery();

            q.Constrain(_array[0]);
            SodaTestUtil.ExpectOne(q, _array[0]);
        }
Esempio n. 5
0
        public virtual void TestNotIdentity()
        {
            var q = NewQuery();

            q.Constrain(new STStringUTestCase
                            ("aaa"));
            var set = q.Execute();
            var identityConstraint
                = (STStringUTestCase)set.Next
                      ();

            identityConstraint.str = null;
            q = NewQuery();
            q.Constrain(identityConstraint).Identity().Not();
            identityConstraint.str = "aaa";
            SodaTestUtil.Expect(q, new object[]
            {
                new STStringUTestCase
                    (null),
                new STStringUTestCase(
                    "bbb"),
                new STStringUTestCase(
                    "dod")
            });
        }
Esempio n. 6
0
        public virtual void TestSmaller()
        {
            var q = NewQuery();

            q.Constrain(new STByteTestCase(1));
            q.Descend(Descendant).Constraints().Smaller();
            SodaTestUtil.ExpectOne(q, _array[0]);
        }
Esempio n. 7
0
        public virtual void TestEquals()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STByteWUTestCase
                            ((byte)0));
            SodaTestUtil.ExpectOne(q, _array[0]);
        }
Esempio n. 8
0
        public virtual void TestEquals()
        {
            var q = NewQuery();

            q.Constrain(new STByteWUTestCase
                            (0));
            SodaTestUtil.ExpectOne(q, _array[0]);
        }
Esempio n. 9
0
        /// <summary>
        /// Magic:
        /// Query for all objects with a known attribute,
        /// independant of the class or even if you don't
        /// know the class.
        /// </summary>
        /// <remarks>
        /// Magic:
        /// Query for all objects with a known attribute,
        /// independant of the class or even if you don't
        /// know the class.
        /// </remarks>
        public virtual void TestUnconstrainedClass()
        {
            IQuery q = NewQuery();

            q.Descend("str").Constrain("aaa");
            SodaTestUtil.Expect(q, new object[] { new Db4objects.Db4o.Tests.Common.Soda.Experiments.STMagicTestCase
                                                      ("aaa"), new STStringTestCase("aaa"), new STStringUTestCase("aaa") });
        }
Esempio n. 10
0
        public virtual void TestEquals()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STLongTestCase(long.MinValue
                                                                                            ));
            SodaTestUtil.Expect(q, new object[] { new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STLongTestCase
                                                      (long.MinValue) });
        }
Esempio n. 11
0
        public virtual void TestEqualsTrue()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STBooleanTestCase
                            (true));
            SodaTestUtil.ExpectOne(q, new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STBooleanTestCase
                                       (true));
        }
Esempio n. 12
0
        //	public void testRegularExpression() {
        //		Query q = newQuery();
        //		q.constrain(STMagicTestCase.class);
        //		Query qStr = q.descend("str");
        //		final Pattern pattern = Pattern.compile("a*x");
        //		qStr.constrain(new Evaluation() {
        //			public void evaluate(Candidate candidate) {
        //				candidate.include(pattern.matcher(((String) candidate.getObject())).matches());
        //			}
        //		});
        //		com.db4o.db4ounit.common.soda.util.SodaTestUtil.expectOne(q, _array[1]);
        //	}
        /// <summary>
        /// Magic:
        /// Querying for an implemented Interface.
        /// </summary>
        /// <remarks>
        /// Magic:
        /// Querying for an implemented Interface.
        /// Using an Evaluation allows calls to the interface methods
        /// during the run of the query.s
        /// </remarks>
        public virtual void TestInterface()
        {
            IQuery q = NewQuery();

            q.Constrain(typeof(ISTInterface));
            q.Constrain(new _IEvaluation_117());
            SodaTestUtil.Expect(q, new object[] { new Db4objects.Db4o.Tests.Common.Soda.Experiments.STMagicTestCase
                                                      ("aaa"), new STStringTestCase("aaa") });
        }
Esempio n. 13
0
        public virtual void TestSmaller()
        {
            var q = NewQuery();

            q.Constrain(new STIntegerWUTestCase
                            (1));
            q.Descend("i_int").Constraints().Smaller();
            SodaTestUtil.ExpectOne(q, _array[0]);
        }
Esempio n. 14
0
        public virtual void TestSmaller()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STByteTestCase((
                                                                                                byte)1));
            q.Descend(Descendant).Constraints().Smaller();
            SodaTestUtil.ExpectOne(q, _array[0]);
        }
Esempio n. 15
0
        public virtual void TestEquals()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STLongWUTestCase
                            (long.MinValue));
            SodaTestUtil.Expect(q, new object[] { new Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STLongWUTestCase
                                                      (long.MinValue) });
        }
Esempio n. 16
0
        public virtual void TestEqualsTrue()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STBooleanWUTestCase
                            (true));
            SodaTestUtil.ExpectOne(q, new Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STBooleanWUTestCase
                                       (true));
        }
Esempio n. 17
0
        public virtual void TestSmaller()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STCharWUTestCase
                            ((char)1));
            q.Descend(Descendant).Constraints().Smaller();
            SodaTestUtil.ExpectOne(q, _array[0]);
        }
Esempio n. 18
0
        public virtual void TestEqualsTrue()
        {
            var q = NewQuery();

            q.Constrain(new STBooleanTestCase
                            (true));
            SodaTestUtil.ExpectOne(q, new STBooleanTestCase
                                       (true));
        }
Esempio n. 19
0
        public virtual void TestContains()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STStringTestCase
                            ("od"));
            q.Descend("str").Constraints().Contains();
            SodaTestUtil.ExpectOne(q, new Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STStringTestCase
                                       ("dod"));
        }
Esempio n. 20
0
        public virtual void TestContains()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STStringUTestCase
                            ("od"));
            q.Descend("str").Constraints().Contains();
            SodaTestUtil.ExpectOne(q, new Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STStringUTestCase
                                       ("dod"));
        }
Esempio n. 21
0
        public virtual void TestBothNull()
        {
            var q = NewQuery();

            q.Constrain(new STTH1TestCase
                            ());
            q.Descend("foo1").Constrain(null);
            q.Descend("h2").Constrain(null);
            SodaTestUtil.ExpectOne(q, _array[0]);
        }
Esempio n. 22
0
        public virtual void TestBothNull()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Classes.Typedhierarchy.STRTH1TestCase
                            ());
            q.Descend("foo1").Constrain(null);
            q.Descend("h2").Constrain(null);
            SodaTestUtil.ExpectOne(q, _array[0]);
        }
Esempio n. 23
0
        public virtual void TestNull()
        {
            IQuery q = NewQuery();

            q.Constrain(new Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STBooleanWUTestCase
                            ());
            q.Descend(Descendant).Constrain(null);
            SodaTestUtil.ExpectOne(q, new Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STBooleanWUTestCase
                                       ());
        }
Esempio n. 24
0
        public virtual void TestNull()
        {
            var q = NewQuery();

            q.Constrain(new STStringTestCase
                            (null));
            q.Descend("str").Constrain(null);
            SodaTestUtil.ExpectOne(q, new STStringTestCase
                                       (null));
        }
Esempio n. 25
0
        public virtual void TestEvaluation()
        {
            var q = NewQuery();

            q.Constrain(new STStringTestCase
                            (null));
            q.Constrain(new _IEvaluation_187());
            SodaTestUtil.ExpectOne(q, new STStringTestCase
                                       ("dod"));
        }
Esempio n. 26
0
        public virtual void TestCaseInsenstiveContains()
        {
            var q = NewQuery();

            q.Constrain(typeof(STStringTestCase
                               ));
            q.Constrain(new _IEvaluation_199());
            SodaTestUtil.ExpectOne(q, new STStringTestCase
                                       ("dod"));
        }
Esempio n. 27
0
        public virtual void TestContains()
        {
            var q = NewQuery();

            q.Constrain(new STStringTestCase
                            ("od"));
            q.Descend("str").Constraints().Contains();
            SodaTestUtil.ExpectOne(q, new STStringTestCase
                                       ("dod"));
        }
Esempio n. 28
0
        public virtual void TestDescendantEquals()
        {
            var q = NewQuery();

            q.Constrain(new STStringTestCase
                            ());
            q.Descend("str").Constrain("bbb");
            SodaTestUtil.ExpectOne(q, new STStringTestCase
                                       ("bbb"));
        }
Esempio n. 29
0
        /// <summary>
        /// Magic:
        /// Execute any node in the query graph.
        /// </summary>
        /// <remarks>
        /// Magic:
        /// Execute any node in the query graph.
        /// The data for this example can be found in STTH1.java.
        /// </remarks>
        public virtual void TestExecuteAnyNode()
        {
            IQuery q = NewQuery();

            q.Constrain(new STTH1TestCase().CreateData()[5]);
            q = q.Descend("h2").Descend("h3");
            //	We only get one STTH3 here, because the query is
            //	constrained by the STTH2 with the "str2" member.
            SodaTestUtil.ExpectOne(q, new STTH3("str3"));
        }
Esempio n. 30
0
        public virtual void TestEquals()
        {
            var q = NewQuery();

            q.Constrain(new STByteTestCase(0));
            // Primitive default values are ignored, so we need an
            // additional constraint:
            q.Descend(Descendant).Constrain((byte)0);
            SodaTestUtil.ExpectOne(q, _array[0]);
        }