Esempio n. 1
0
        /// <exception cref="System.Exception"/>
        public virtual void TestUnmarshallWrongType()
        {
            byte[]        bytes         = Sharpen.Runtime.GetBytesForString("{'type':''}");
            ServiceRecord serviceRecord = marshal.FromBytes("marshalling", bytes);

            RegistryTypeUtils.ValidateServiceRecord("validating", serviceRecord);
        }
Esempio n. 2
0
        /// <exception cref="System.Exception"/>
        public virtual void TestRecordValidationWrongType()
        {
            ServiceRecord record = new ServiceRecord();

            record.type = "NotAServiceRecordType";
            RegistryTypeUtils.ValidateServiceRecord("validating", record);
        }
Esempio n. 3
0
        public virtual void TestRoundTrip()
        {
            string        persistence = PersistencePolicies.Permanent;
            ServiceRecord record      = CreateRecord(persistence);

            record.Set("customkey", "customvalue");
            record.Set("customkey2", "customvalue2");
            RegistryTypeUtils.ValidateServiceRecord(string.Empty, record);
            Log.Info(marshal.ToJson(record));
            byte[]        bytes = marshal.ToBytes(record);
            ServiceRecord r2    = marshal.FromBytes(string.Empty, bytes);

            AssertMatches(record, r2);
            RegistryTypeUtils.ValidateServiceRecord(string.Empty, r2);
        }