/// <exception cref="System.Exception"/> public virtual void TestUnmarshallWrongType() { byte[] bytes = Sharpen.Runtime.GetBytesForString("{'type':''}"); ServiceRecord serviceRecord = marshal.FromBytes("marshalling", bytes); RegistryTypeUtils.ValidateServiceRecord("validating", serviceRecord); }
/// <exception cref="System.Exception"/> public virtual void TestRecordValidationWrongType() { ServiceRecord record = new ServiceRecord(); record.type = "NotAServiceRecordType"; RegistryTypeUtils.ValidateServiceRecord("validating", record); }
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); }