Esempio n. 1
0
        private void AssertStoredField(Type objectClass, string fieldName, object expectedFieldValue
                                       , Type expectedFieldType, bool hasIndex, bool isArray)
        {
            IStoredClass storedClass = StoredClass(objectClass);

            IStoredField[] storedFields = storedClass.GetStoredFields();
            Assert.AreEqual(1, storedFields.Length);
            IStoredField storedField = storedFields[0];

            Assert.AreEqual(fieldName, storedField.GetName());
            IStoredField storedFieldByName = storedClass.StoredField(fieldName, expectedFieldType
                                                                     );

            Assert.AreEqual(storedField, storedFieldByName);
            object item = RetrieveOnlyInstance(objectClass);

            Assert.AreEqual(expectedFieldValue, storedField.Get(item));
            IReflectClass fieldType = storedField.GetStoredType();

            Assert.AreEqual(Reflector().ForClass(expectedFieldType), fieldType);
            Assert.AreEqual(isArray, storedField.IsArray());
            if (IsMultiSession())
            {
                return;
            }
            Assert.AreEqual(hasIndex, storedField.HasIndex());
            // FIXME: test rename
            if (!hasIndex)
            {
                Assert.Expect(typeof(Exception), new _ICodeBlock_113(storedField));
            }
            else
            {
                IntByRef count = new IntByRef();
                storedField.TraverseValues(new _IVisitor4_123(count, expectedFieldValue));
                Assert.AreEqual(1, count.value);
            }
        }