public void ReadAllKeysByMapType_TypeIsNotMap_ThrowTypeCodeReadError(Type t) { var val = RandomHelper.RandomValue(t); var buf = BssomSerializer.Serialize(val); var bsfm = new BssomFieldMarshaller(buf); VerifyHelper.Throws <BssomSerializationOperationException>(() => bsfm.ReadAllKeysByMapType <object>(BssomFieldOffsetInfo.Zero), ex => ex.ErrorCode == BssomSerializationOperationException.SerializationErrorCode.IncorrectTypeCode); }
public void Map_ReadAllKeysByMapType_IsCorrectly(bool isSerializeMap1Type) { var val = RandomHelper.RandomValueWithOutStringEmpty <Dictionary <string, int> >(); var buf = BssomSerializer.Serialize(val, BssomSerializerOptions.Default.WithIDictionaryIsSerializeMap1Type(isSerializeMap1Type)); var bsfm = new BssomFieldMarshaller(buf); var keys = bsfm.ReadAllKeysByMapType <string>(BssomFieldOffsetInfo.Zero); foreach (var item in keys) { val.TryGetValue(item.Key, out int itemVal).IsTrue(); itemVal.Is(bsfm.ReadValue <int>(item.Value)); val.Remove(item.Key).IsTrue(); } }
public void GetAllFieldMetas() { foreach (var item in BssomFieldMarshaller.ReadAllKeysByMapType <string>(OutPut, 0, OutPut.Length, BssomFieldOffsetInfo.Zero)) { } }