示例#1
0
 private void AssertItem(IObjectSet objectSet, QueryByExampleTestCase.Item item)
 {
     Assert.AreEqual(1, objectSet.Count);
     QueryByExampleTestCase.Item retrievedItem = (QueryByExampleTestCase.Item)objectSet
                                                 .Next();
     Assert.AreSame(item, retrievedItem);
 }
示例#2
0
        public virtual void TestQueryByExampleNoneFound()
        {
            QueryByExampleTestCase.Item itemOne = new QueryByExampleTestCase.Item("one");
            QueryByExampleTestCase.Item itemTwo = new QueryByExampleTestCase.Item("two");
            Store(itemOne);
            Store(itemTwo);
            // Change the name of the "sample"
            itemOne._name = "three";
            IObjectSet objectSet = Db().QueryByExample(itemOne);

            Assert.AreEqual(0, objectSet.Count);
        }
示例#3
0
		public virtual void TestQueryByExample()
		{
			QueryByExampleTestCase.Item itemOne = new QueryByExampleTestCase.Item("one");
			QueryByExampleTestCase.Item itemTwo = new QueryByExampleTestCase.Item("two");
			Store(itemOne);
			Store(itemTwo);
			// Change the name of the "sample"
			itemOne._name = "two";
			// Query by Example
			IObjectSet objectSet = Db().QueryByExample(itemOne);
			AssertItem(objectSet, itemTwo);
		}
示例#4
0
        public virtual void TestQueryByExample()
        {
            QueryByExampleTestCase.Item itemOne = new QueryByExampleTestCase.Item("one");
            QueryByExampleTestCase.Item itemTwo = new QueryByExampleTestCase.Item("two");
            Store(itemOne);
            Store(itemTwo);
            // Change the name of the "sample"
            itemOne._name = "two";
            // Query by Example
            IObjectSet objectSet = Db().QueryByExample(itemOne);

            AssertItem(objectSet, itemTwo);
        }
示例#5
0
		public virtual void TestDefaultQueryModeIsIdentity()
		{
			QueryByExampleTestCase.Item itemOne = new QueryByExampleTestCase.Item("one");
			QueryByExampleTestCase.Item itemTwo = new QueryByExampleTestCase.Item("two");
			Store(itemOne);
			Store(itemTwo);
			// Change the name of the "sample"
			itemOne._name = "two";
			// Query by Identity
			IQuery q = Db().Query();
			q.Constrain(itemOne);
			IObjectSet objectSet = q.Execute();
			AssertItem(objectSet, itemOne);
		}
示例#6
0
		public virtual void TestConstrainByExample()
		{
			QueryByExampleTestCase.Item itemOne = new QueryByExampleTestCase.Item("one");
			QueryByExampleTestCase.Item itemTwo = new QueryByExampleTestCase.Item("two");
			Store(itemOne);
			Store(itemTwo);
			// Change the name of the "sample"
			itemOne._name = "two";
			// Query by Example
			IQuery q = Db().Query();
			q.Constrain(itemOne).ByExample();
			IObjectSet objectSet = q.Execute();
			// Expect to get the other 
			AssertItem(objectSet, itemTwo);
		}
示例#7
0
        public virtual void TestDefaultQueryModeIsIdentity()
        {
            QueryByExampleTestCase.Item itemOne = new QueryByExampleTestCase.Item("one");
            QueryByExampleTestCase.Item itemTwo = new QueryByExampleTestCase.Item("two");
            Store(itemOne);
            Store(itemTwo);
            // Change the name of the "sample"
            itemOne._name = "two";
            // Query by Identity
            IQuery q = Db().Query();

            q.Constrain(itemOne);
            IObjectSet objectSet = q.Execute();

            AssertItem(objectSet, itemOne);
        }
示例#8
0
        public virtual void TestConstrainByExample()
        {
            QueryByExampleTestCase.Item itemOne = new QueryByExampleTestCase.Item("one");
            QueryByExampleTestCase.Item itemTwo = new QueryByExampleTestCase.Item("two");
            Store(itemOne);
            Store(itemTwo);
            // Change the name of the "sample"
            itemOne._name = "two";
            // Query by Example
            IQuery q = Db().Query();

            q.Constrain(itemOne).ByExample();
            IObjectSet objectSet = q.Execute();

            // Expect to get the other
            AssertItem(objectSet, itemTwo);
        }
示例#9
0
		public virtual void TestQueryByExampleNoneFound()
		{
			QueryByExampleTestCase.Item itemOne = new QueryByExampleTestCase.Item("one");
			QueryByExampleTestCase.Item itemTwo = new QueryByExampleTestCase.Item("two");
			Store(itemOne);
			Store(itemTwo);
			// Change the name of the "sample"
			itemOne._name = "three";
			IObjectSet objectSet = Db().QueryByExample(itemOne);
			Assert.AreEqual(0, objectSet.Count);
		}