예제 #1
0
        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);
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
 public void GetAllFieldMetas()
 {
     foreach (var item in BssomFieldMarshaller.ReadAllKeysByMapType <string>(OutPut, 0, OutPut.Length, BssomFieldOffsetInfo.Zero))
     {
     }
 }