public void GuidPropKNTTest()
        {
            const int hvo = 1;
            // Set class first, or it will throw the exception in the wrong place.
            var clidLe = SilDataAccess.MetaDataCache.GetClassId("ClassD");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clidLe);
            const int tag = (int)CmObjectFields.kflidCmObject_Guid;

            SilDataAccess.get_GuidProp(hvo, tag);
        }
Beispiel #2
0
        public void UnkPropKNTTest()
        {
            const int hvo = 1;
            // Set class first, or it will throw the exception in the wrong place.
            var clid = SilDataAccess.MetaDataCache.GetClassId("ClassG");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);

            var tag = SilDataAccess.MetaDataCache.GetFieldId("ClassG", "TextPropsProp7", false);

            SilDataAccess.get_UnknownProp(hvo, tag);
        }
        public void In64PropKNTTest()
        {
            CheckDisposed();

            int hvo = 1;
            // Set class first, or it will throw the exception in the wrong place.
            uint clidLe = SilDataAccess.MetaDataCache.GetClassId("CmPerson");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clidLe);
            int  tag = (int)SilDataAccess.MetaDataCache.GetFieldId("CmPerson", "DateOfBirth", false);
            long dob = SilDataAccess.get_Int64Prop(hvo, tag);
        }
Beispiel #4
0
        public void BinaryPropKNTTest()
        {
            const int hvo = 1;
            // Set class first, or it will throw the exception in the wrong place.
            var clid = SilDataAccess.MetaDataCache.GetClassId("ClassI");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);
            var tag = SilDataAccess.MetaDataCache.GetFieldId("ClassI", "BinaryProp9", false);
            int chvo;

            SilDataAccess.BinaryPropRgb(hvo, tag, ArrayPtr.Null, 0, out chvo);
        }
        public void UnicodePropKNTTest()
        {
            CheckDisposed();

            int hvo = 1;
            // Set class first, or it will throw the exception in the wrong place.
            uint clid = SilDataAccess.MetaDataCache.GetClassId("LangProject");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);

            int    tag = (int)SilDataAccess.MetaDataCache.GetFieldId("LangProject", "EthnologueCode", false);
            string ec  = SilDataAccess.get_UnicodeProp(hvo, tag);
        }
        public void BoolPropKNTTest()
        {
            CheckDisposed();

            int hvo = 1;
            // Set class first, or it will throw the exception in the wrong place.
            uint clidLe = SilDataAccess.MetaDataCache.GetClassId("WfiAnalysis");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clidLe);
            int tag = (int)SilDataAccess.MetaDataCache.GetFieldId("WfiAnalysis", "Category", false);

            bool excludeOriginal = SilDataAccess.get_BooleanProp(hvo, tag);
        }
        public void TimePropKNTTest()
        {
            CheckDisposed();

            int hvo = 1;
            // Set class first, or it will throw the exception in the wrong place.
            uint clid = SilDataAccess.MetaDataCache.GetClassId("LexEntry");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);

            int  tag = (int)SilDataAccess.MetaDataCache.GetFieldId("LexEntry", "DateCreated", false);
            long dob = SilDataAccess.get_TimeProp(hvo, tag);
        }
Beispiel #8
0
        public void MultiStringNegativeWSTest()
        {
            // Set class first, or it will throw an exception.
            const int hvo  = 1;
            var       clid = SilDataAccess.MetaDataCache.GetClassId("ClassK");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);
            var tag = SilDataAccess.MetaDataCache.GetFieldId("ClassK", "MultiStringProp11", false);

            var tss = TsStringUtils.MakeString("Verb", 1);

            SilDataAccess.SetMultiStringAlt(hvo, tag, -1, tss);
        }
        public void IntPropKNTTest()
        {
            CheckDisposed();

            int hvo = 1;
            // Set class first, or it will throw the exception in the wrong place.
            uint clid = SilDataAccess.MetaDataCache.GetClassId("MoAdhocProhib");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);

            int tag   = (int)SilDataAccess.MetaDataCache.GetFieldId("MoAdhocProhib", "Adjacency", false);
            int clid1 = SilDataAccess.get_IntProp(hvo, tag);
        }
Beispiel #10
0
        public void UnkPropWrongInterfaceTest()
        {
            // First, set up class id.
            const int hvo  = 1;
            var       clid = SilDataAccess.MetaDataCache.GetClassId("ClassG");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);

            var tsPropsBuilder = TsStringUtils.MakePropsBldr();
            var tag            = SilDataAccess.MetaDataCache.GetFieldId("ClassG", "TextPropsProp7", false);

            SilDataAccess.SetUnknown(hvo, tag, tsPropsBuilder);
        }
Beispiel #11
0
        public void UnkPropKNTTest()
        {
            CheckDisposed();

            int hvo = 1;
            // Set class first, or it will throw the exception in the wrong place.
            uint clid = SilDataAccess.MetaDataCache.GetClassId("StPara");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);

            int    tag = (int)SilDataAccess.MetaDataCache.GetFieldId("StPara", "StyleRules", false);
            object unk = SilDataAccess.get_UnknownProp(hvo, tag);
        }
Beispiel #12
0
        public void StringPropKNTTest()
        {
            CheckDisposed();

            // Set class first, or it will throw an exception.
            int  hvo  = 1;
            uint clid = SilDataAccess.MetaDataCache.GetClassId("PhEnvironment");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);
            int tag = (int)SilDataAccess.MetaDataCache.GetFieldId("PhEnvironment", "StringRepresentation", false);

            ITsString tsStringNew = SilDataAccess.get_StringProp(hvo, tag);
        }
Beispiel #13
0
        public void GuidPropKNTTest()
        {
            CheckDisposed();

            int hvo = 1;
            // Set class first, or it will throw the exception in the wrong place.
            uint clidLe = SilDataAccess.MetaDataCache.GetClassId("LexEntry");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clidLe);
            int tag = (int)CmObjectFields.kflidCmObject_Guid;

            Guid uid = SilDataAccess.get_GuidProp(hvo, tag);
        }
Beispiel #14
0
        public void UnkPropMisMatchedFlidTest()
        {
            // First, set up class id.
            const int hvo  = 1;
            var       clid = SilDataAccess.MetaDataCache.GetClassId("ClassE");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);

            var tsPropsBuilder = TsStringUtils.MakePropsBldr();
            var props          = tsPropsBuilder.GetTextProps();
            var tag            = SilDataAccess.MetaDataCache.GetFieldId("ClassE", "UnicodeProp4", false);

            SilDataAccess.SetUnknown(hvo, tag, props);
        }
Beispiel #15
0
        public void UnkPropWrongInterfaceTest()
        {
            CheckDisposed();

            // First, set up class id.
            int  hvo  = 1;
            uint clid = SilDataAccess.MetaDataCache.GetClassId("StPara");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);

            ITsPropsBldr tsPropsBuilder = TsPropsBldrClass.Create();
            int          tag            = (int)SilDataAccess.MetaDataCache.GetFieldId("StPara", "StyleRules", false);

            SilDataAccess.SetUnknown(hvo, tag, tsPropsBuilder);
        }
Beispiel #16
0
        public void BinaryPropWrongLengthTest()
        {
            const int hvo  = 1;
            var       clid = SilDataAccess.MetaDataCache.GetClassId("ClassI");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);
            var tag = SilDataAccess.MetaDataCache.GetFieldId("ClassI", "BinaryProp9", false);

            using (var arrayPtr = MarshalEx.ArrayToNative <int>(2))
            {
                var prgb = new byte[] { 3, 4, 5 };
                int chvo;
                SilDataAccess.SetBinary(hvo, tag, prgb, prgb.Length);
                SilDataAccess.BinaryPropRgb(hvo, tag, arrayPtr, 2, out chvo);
            }
        }
Beispiel #17
0
        public void UnkPropMisMatchedFlidTest()
        {
            CheckDisposed();

            // First, set up class id.
            int  hvo  = 1;
            uint clid = SilDataAccess.MetaDataCache.GetClassId("StPara");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);

            ITsPropsBldr tsPropsBuilder = TsPropsBldrClass.Create();
            ITsTextProps props          = tsPropsBuilder.GetTextProps();
            int          tag            = (int)SilDataAccess.MetaDataCache.GetFieldId("StPara", "StyleName", false);

            SilDataAccess.SetUnknown(hvo, tag, props);
        }
Beispiel #18
0
        public void MultiString0WSTest()
        {
            CheckDisposed();

            // Set class first, or it will throw an exception.
            int  hvo  = 1;
            uint clid = SilDataAccess.MetaDataCache.GetClassId("CmPossibility");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);
            int tag = (int)SilDataAccess.MetaDataCache.GetFieldId("CmPossibility", "Name", false);

            ITsStrFactory tsf = TsStrFactoryClass.Create();
            ITsString     tss = tsf.MakeString("Verb", 1);

            SilDataAccess.SetMultiStringAlt(hvo, tag, 0, tss);
        }
Beispiel #19
0
        public void TimePropTest()
        {
            // ClassD->TimeProp6
            // First, set up class id.
            const int hvo  = 2;
            var       clid = SilDataAccess.MetaDataCache.GetClassId("ClassD");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);

            const long doc = long.MinValue;
            var        tag = SilDataAccess.MetaDataCache.GetFieldId("ClassD", "TimeProp6", false);

            SilDataAccess.SetTime(hvo, tag, doc);
            var doc2 = SilDataAccess.get_TimeProp(hvo, tag);

            Assert.AreEqual(doc, doc2, "Wrong creation in cache.");
        }
Beispiel #20
0
        public void BoolPropTest()
        {
            // Set class first, or it will throw an exception.
            const int hvo    = 1;
            var       clidLe = SilDataAccess.MetaDataCache.GetClassId("ClassD");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clidLe);

            // Now set its 'BoolProp3' property.
            var        tag             = SilDataAccess.MetaDataCache.GetFieldId("ClassD", "BoolProp3", false);
            const bool excludeOriginal = true;

            SilDataAccess.SetBoolean(hvo, tag, excludeOriginal);
            var excludeOriginal1 = SilDataAccess.get_BooleanProp(hvo, tag);

            Assert.AreEqual(excludeOriginal, excludeOriginal1, "Wrong bool in cache.");
        }
Beispiel #21
0
        public void UnkPropTest()
        {
            // First, set up class id.
            const int hvo  = 1;
            var       clid = SilDataAccess.MetaDataCache.GetClassId("ClassG");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);

            var tsPropsBuilder = TsStringUtils.MakePropsBldr();
            var props          = tsPropsBuilder.GetTextProps();
            var tag            = SilDataAccess.MetaDataCache.GetFieldId("ClassG", "TextPropsProp7", false);

            SilDataAccess.SetUnknown(hvo, tag, props);
            var props2 = (ITsTextProps)SilDataAccess.get_UnknownProp(hvo, tag);

            Assert.AreEqual(props, props2, "Wrong text props in cache.");
        }
Beispiel #22
0
        public void Int64PropTest()
        {
            // ClassF->Int64Prop5:GenDate
            // First, set up class id.
            const int hvo  = 1;
            var       clid = SilDataAccess.MetaDataCache.GetClassId("ClassF");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);

            const long dob = long.MinValue;
            var        tag = SilDataAccess.MetaDataCache.GetFieldId("ClassF", "Int64Prop5", false);

            SilDataAccess.SetInt64(hvo, tag, dob);
            var dob2 = SilDataAccess.get_Int64Prop(hvo, tag);

            Assert.AreEqual(dob, dob2, "Wrong DOB in cache.");
        }
Beispiel #23
0
        public void StringPropTest()
        {
            // Set class first, or it will throw an exception.
            const int hvo  = 1;
            var       clid = SilDataAccess.MetaDataCache.GetClassId("ClassJ");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);
            var tag = SilDataAccess.MetaDataCache.GetFieldId("ClassJ", "StringProp10", false);

            var tsString = TsStringUtils.MakeString("/ a _", 42, "Verse");

            SilDataAccess.SetString(hvo, tag, tsString);

            var tsStringNew = SilDataAccess.get_StringProp(hvo, tag);

            Assert.AreEqual(tsString, tsStringNew);
        }
Beispiel #24
0
        public void BoolPropTest()
        {
            // Set class first, or it will throw an exception.
            int  hvo    = 1;
            uint clidLe = SilDataAccess.MetaDataCache.GetClassId("LexEntry");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clidLe);

            // Now set its 'ExcludeAsHeadword' property.
            int  tag             = (int)SilDataAccess.MetaDataCache.GetFieldId("LexEntry", "ExcludeAsHeadword", false);
            bool excludeOriginal = true;

            SilDataAccess.SetBoolean(hvo, tag, excludeOriginal);
            bool excludeOriginal1 = SilDataAccess.get_BooleanProp(hvo, tag);

            Assert.AreEqual(excludeOriginal, excludeOriginal1, "Wrong bool in cache.");
        }
Beispiel #25
0
        public void BinaryPropWrongLengthTest()
        {
            CheckDisposed();

            int  hvo  = 1;
            uint clid = SilDataAccess.MetaDataCache.GetClassId("ScrImportSet");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);
            int tag = (int)SilDataAccess.MetaDataCache.GetFieldId("ScrImportSet", "ImportSettings", false);

            using (ArrayPtr arrayPtr = MarshalEx.ArrayToNative(2, typeof(int)))
            {
                byte[] prgb = new byte[] { 3, 4, 5 };
                int    chvo;
                SilDataAccess.SetBinary(hvo, tag, prgb, prgb.Length);
                SilDataAccess.BinaryPropRgb(hvo, tag, arrayPtr, 2, out chvo);
            }
        }
        public void MultiStringPropTest()
        {
            // Set class first, or it will throw an exception.
            const int hvo  = 1;
            var       clid = SilDataAccess.MetaDataCache.GetClassId("ClassK");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);
            var tag = SilDataAccess.MetaDataCache.GetFieldId("ClassK", "MultiStringProp11", false);

            var tsf = TsStrFactoryClass.Create();
            var tss = tsf.MakeString("Verb", 1);

            SilDataAccess.SetMultiStringAlt(hvo, tag, 1, tss);

            var tssNew = SilDataAccess.get_MultiStringAlt(hvo, tag, 1);

            Assert.AreEqual(tss, tssNew);
        }
Beispiel #27
0
        public void UnkPropTest()
        {
            CheckDisposed();

            // First, set up class id.
            int  hvo  = 1;
            uint clid = SilDataAccess.MetaDataCache.GetClassId("StPara");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);

            ITsPropsBldr tsPropsBuilder = TsPropsBldrClass.Create();
            ITsTextProps props          = tsPropsBuilder.GetTextProps();
            int          tag            = (int)SilDataAccess.MetaDataCache.GetFieldId("StPara", "StyleRules", false);

            SilDataAccess.SetUnknown(hvo, tag, props);
            ITsTextProps props2 = (ITsTextProps)SilDataAccess.get_UnknownProp(hvo, tag);

            Assert.AreEqual(props, props2, "Wrong text props in cache.");
        }
Beispiel #28
0
        public void AllMultiStringPropTest()
        {
            // Set class first, or it will throw an exception.
            const int hvo  = 1;
            var       clid = SilDataAccess.MetaDataCache.GetClassId("ClassK");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, clid);
            var tag = SilDataAccess.MetaDataCache.GetFieldId("ClassK", "MultiStringProp11", false);

            var tss = TsStringUtils.MakeString("Verb", 1);

            SilDataAccess.SetMultiStringAlt(hvo, tag, 1, tss);
            tss = TsStringUtils.MakeString("Verbo", 2);
            SilDataAccess.SetMultiStringAlt(hvo, tag, 2, tss);

            var tsms = SilDataAccess.get_MultiStringProp(hvo, tag);

            Assert.AreEqual(tsms.StringCount, 2);
        }
Beispiel #29
0
        public void TimePropTest()
        {
            CheckDisposed();

            // LexEntry->DateCreated
            // First, set up class id.
            int  hvo  = 2;
            uint clid = SilDataAccess.MetaDataCache.GetClassId("LexEntry");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);

            long doc = long.MinValue;
            int  tag = (int)SilDataAccess.MetaDataCache.GetFieldId("LexEntry", "DateCreated", false);

            SilDataAccess.SetTime(hvo, tag, doc);
            long doc2 = SilDataAccess.get_TimeProp(hvo, tag);

            Assert.AreEqual(doc, doc2, "Wrong creation in cache.");
        }
Beispiel #30
0
        public void Int64PropTest()
        {
            CheckDisposed();

            // CmPerson->DateOfBirth:GenDate
            // First, set up class id.
            int  hvo  = 1;
            uint clid = SilDataAccess.MetaDataCache.GetClassId("CmPerson");

            SilDataAccess.SetInt(hvo, (int)CmObjectFields.kflidCmObject_Class, (int)clid);

            long dob = long.MinValue;             // Use 'Adam' :-)
            int  tag = (int)SilDataAccess.MetaDataCache.GetFieldId("CmPerson", "DateOfBirth", false);

            SilDataAccess.SetInt64(hvo, tag, dob);
            long dob2 = SilDataAccess.get_Int64Prop(hvo, tag);

            Assert.AreEqual(dob, dob2, "Wrong DOB in cache.");
        }