private static void AssertNullableType(TestSubject expected, TestSubject actual)
        {
            Assert.IsNotNull(actual);

            Assert.IsTrue(actual._nullableInt.HasValue);
            Assert.IsFalse(actual._valueType2.HasValue);
            Assert.IsNotNull(actual._valueType);

            Assert.AreEqual(
                expected._valueType.Value._value,
                actual._valueType.Value._value);

            Assert.AreEqual(
                expected._valueType.Value._name,
                actual._valueType.Value._name);

            Assert.AreEqual(
                expected._valueType.Value._nullableBool.HasValue,
                actual._valueType.Value._nullableBool.HasValue);

            if (expected._valueType.Value._nullableBool.HasValue)
            {
                Assert.AreEqual(
                    expected._valueType.Value._nullableBool.Value,
                    actual._valueType.Value._nullableBool.Value);
            }

            Assert.IsNotNull(actual._elements);
            Assert.IsNotNull(actual._nullableArray);
            for (var i = 0; i < actual._elements.Length; i += 2)
            {
                Assert.IsNull(actual._elements[i]);
            }

            var values = (int?[])actual._nullableArray;

            for (var i = 1; i < actual._elements.Length; i += 2)
            {
                Assert.IsNotNull(actual._elements[i]);
                Assert.AreEqual(i, actual._elements[i]);
                Assert.AreEqual(i, values[i]);
            }
        }
		private static void AssertNullableType(TestSubject expected, TestSubject actual)
		{
			Assert.IsNotNull(actual);

			Assert.IsTrue(actual._nullableInt.HasValue);
			Assert.IsFalse(actual._valueType2.HasValue);
			Assert.IsNotNull(actual._valueType);
			
            Assert.AreEqual(
                expected._valueType.Value._value,
                actual._valueType.Value._value);
			
            Assert.AreEqual(
                expected._valueType.Value._name,
                actual._valueType.Value._name);

            Assert.AreEqual(
                expected._valueType.Value._nullableBool.HasValue, 
                actual._valueType.Value._nullableBool.HasValue);

            if (expected._valueType.Value._nullableBool.HasValue)
            {
                Assert.AreEqual(
                    expected._valueType.Value._nullableBool.Value,
                    actual._valueType.Value._nullableBool.Value);
            }

		    Assert.IsNotNull(actual._elements);
            Assert.IsNotNull(actual._nullableArray);
			for (int i = 0; i < actual._elements.Length; i += 2)
			{
				Assert.IsNull(actual._elements[i]);
			}
		
            int?[] values = (int?[])actual._nullableArray;
            for (int i = 1; i < actual._elements.Length; i += 2)
			{
				Assert.IsNotNull(actual._elements[i]);
				Assert.AreEqual(i, actual._elements[i]);
                Assert.AreEqual(i, values[i]);
			}
		}
Exemple #3
0
        public void TestArrayType()
        {
            TestSubject testSubject = QueryByName("foo");

            Assert.IsInstanceOf(typeof(int?[]), testSubject._elements);
        }