Пример #1
0
 public void Protobuf_DeserializePickled()
 {
     for (int i = 0; i < Iterations; i++)
     {
         var target = new UserLicensesResponsePB();
         _ = Serializers.Protobuf_DeserializePickled <UserLicensesResponsePB>(_protobuf_pickled.WrittenSpan, target);
     }
 }
Пример #2
0
 public void Protobuf_DeserializePlain()
 {
     for (int i = 0; i < Iterations; i++)
     {
         var target = new UserLicensesResponsePB();
         Serializers.Protobuf_DeserializePlain(_protobuf_plain, target);
     }
 }
Пример #3
0
 public void Protobuf_DeserializePlain()
 {
     for (int i = 0; i < Iterations; i++)
     {
         var target = new UserLicensesResponsePB();
         _ = Serializers.Protobuf_DeserializePlain <UserLicensesResponsePB>(_protobuf_plain.WrittenMemory, target);
     }
 }
Пример #4
0
        static TestData()
        {
            var r = new Random();

            foreach (var l in TestValue.Licenses)
            {
                foreach (var sp in l.ServicePlans)
                {
                    sp.Count = r.Next();
                }
            }

            var ulr = new UserLicensesResponsePB();

            // convert the test value from below into the protobuf types
            foreach (var ul in TestValue.Licenses)
            {
                var ulpb = new UserLicensePB();
                ulpb.ObjectId      = ul.ObjectId;
                ulpb.SkuId         = ul.SkuId;
                ulpb.SkuPartNumber = ul.SkuPartNumber;
                ulr.Licenses.Add(ulpb);

                foreach (var fc in ul.FruitColors)
                {
                    ulpb.FruitColors.Add(fc.Key, (ColorPB)fc.Value);
                }

                foreach (var sp in ul.ServicePlans)
                {
                    var sppb = new ServicePlanPB();
                    sppb.AppliesTo       = sp.AppliesTo;
                    sppb.Count           = sp.Count;
                    sppb.ServicePlanId   = sp.ServicePlanId;
                    sppb.ServicePlanName = sp.ServicePlanName;

                    ulpb.SercucePlans.Add(sppb);
                }
            }

            TestValuePB = ulr;
        }