Пример #1
0
        public void TestGlobalQuery()
        {
            IQuery query = NewQuery();

            query.Constrain(typeof(NullableContainer));

            IObjectSet os = query.Execute();

            Assert.AreEqual(2, os.Count);

            bool foundInt  = false;
            bool foundDate = false;

            while (os.HasNext())
            {
                NullableContainer item = (NullableContainer)os.Next();
                if (item.intValue.HasValue)
                {
                    Assert.AreEqual(42, item.intValue.Value);
                    Assert.IsFalse(item.dateValue.HasValue);
                    foundInt = true;
                }
                else if (item.dateValue.HasValue)
                {
                    Assert.AreEqual(TheDate, item.dateValue.Value);
                    Assert.IsFalse(item.intValue.HasValue);
                    foundDate = true;
                }
            }

            Assert.IsTrue(foundInt);
            Assert.IsTrue(foundDate);
        }
Пример #2
0
        private static void CheckDateValueQueryResult(IObjectSet os)
        {
            Assert.AreEqual(1, os.Count);
            NullableContainer found = (NullableContainer)os.Next();

            Assert.AreEqual(TheDate, found.dateValue.Value);
            EnsureIsNull(found.intValue);
        }