< 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
Covered methods:2
Total methods:2
Method coverage:100% (2 of 2)

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    {
 47        int size = model.CalculateSize();
 48        byte[] buffer = new byte[size];
 49        CodedOutputStream output = new CodedOutputStream(buffer);
 410        model.WriteTo(output);
 411        return buffer;
 12    }
 13
 14    public static T Deserialize<T>(object data) where T : IMessage<T>, new()
 15    {
 416        T ret = new T();
 417        ret.MergeFrom((byte[])data);
 418        return ret;
 19    }
 20}