Example #1
0
 /// <exception cref="System.Exception"></exception>
 protected override void AssertRetrievedItem(object obj)
 {
     MixedActivateTestCase.Item item = (MixedActivateTestCase.Item)obj;
     for (int i = 0; i < ItemDepth; i++)
     {
         AssertNullItem(item, ItemDepth - i);
         item = item.Next();
     }
 }
Example #2
0
 public static MixedActivateTestCase.Item NewItem(int depth)
 {
     if (depth == 0)
     {
         return(null);
     }
     MixedActivateTestCase.Item header = new MixedActivateTestCase.Item("Item " + depth
                                                                        , depth);
     header._next = MixedActivateTestCase.TAItem.NewTAITem(depth - 1);
     return(header);
 }
Example #3
0
 internal virtual void AssertActivatedItemByMethod(MixedActivateTestCase.Item item
                                                   , int level)
 {
     for (int i = 0; i < ItemDepth; i++)
     {
         Assert.AreEqual("Item " + (ItemDepth - i), item.GetName());
         Assert.AreEqual(ItemDepth - i, item.GetValue());
         if (i < ItemDepth - 1)
         {
             Assert.IsNotNull(item.Next());
         }
         else
         {
             Assert.IsNull(item.Next());
         }
         item = item.Next();
     }
 }
Example #4
0
 public virtual void TestActivate()
 {
     MixedActivateTestCase.Item item = (MixedActivateTestCase.Item)RetrieveOnlyInstance
                                           (typeof(MixedActivateTestCase.TAItem));
     Assert.IsNull(item._name);
     Assert.IsNull(item._next);
     Assert.AreEqual(0, item._value);
     // depth = 0;
     Db().Activate(item, 0);
     Assert.IsNull(item._name);
     Assert.IsNull(item._next);
     Assert.AreEqual(0, item._value);
     // depth = 1;
     // item.next();
     Db().Activate(item, 1);
     AssertActivatedItemByField(item, 1);
     Db().Activate(item, 5);
     AssertActivatedItemByField(item, 5);
     Db().Activate(item, 10);
     AssertActivatedItemByField(item, 10);
 }
Example #5
0
 private void AssertNullItem(MixedActivateTestCase.Item item, int level)
 {
     if (level % 2 == 0)
     {
         Assert.IsNull(item._name);
         Assert.IsNull(item._next);
         Assert.AreEqual(0, item._value);
     }
     else
     {
         Assert.AreEqual("Item " + level, item._name);
         Assert.AreEqual(level, item._value);
         if (level == 1)
         {
             Assert.IsNull(item._next);
         }
         else
         {
             Assert.IsNotNull(item._next);
         }
     }
 }
Example #6
0
 internal virtual void AssertActivatedItemByField(MixedActivateTestCase.Item item,
                                                  int level)
 {
     for (int i = 0; i < level; i++)
     {
         Assert.AreEqual("Item " + (ItemDepth - i), item._name);
         Assert.AreEqual(ItemDepth - i, item._value);
         if (i < ItemDepth - 1)
         {
             Assert.IsNotNull(item._next);
         }
         else
         {
             Assert.IsNull(item._next);
         }
         item = item._next;
     }
     if (level < ItemDepth)
     {
         Assert.IsNull(item._name);
         Assert.IsNull(item._next);
         Assert.AreEqual(0, item._value);
     }
 }
Example #7
0
			public static MixedActivateTestCase.Item NewItem(int depth)
			{
				if (depth == 0)
				{
					return null;
				}
				MixedActivateTestCase.Item header = new MixedActivateTestCase.Item("Item " + depth
					, depth);
				header._next = MixedActivateTestCase.TAItem.NewTAITem(depth - 1);
				return header;
			}