< Summary

Class:ProtoSerialization
Assembly:DCL.ECSComponents.ProtobufData
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ProtocolBuffers/Serialization/ProtoSerialization.cs
Covered lines:8
Uncovered lines:0
Coverable lines:8
Total lines:20
Line coverage:100% (8 of 8)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Serialize[T](...)0%110100%
Deserialize[T](...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ProtocolBuffers/Serialization/ProtoSerialization.cs

#LineLine coverage
 1using Google.Protobuf;
 2
 3public class ProtoSerialization
 4{
 5    public static byte[] Serialize<T>(T model) where T : IMessage
 6    {
 87        int size = model.CalculateSize();
 88        byte[] buffer = new byte[size];
 89        CodedOutputStream output = new CodedOutputStream(buffer);
 810        model.WriteTo(output);
 811        return buffer;
 12    }
 13
 14    public static T Deserialize<T>(object data) where T : IMessage<T>, new()
 15    {
 816        T ret = new T();
 817        ret.MergeFrom((byte[])data);
 818        return ret;
 19    }
 20}