< Summary

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

Metrics

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

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    {
 07        int size = model.CalculateSize();
 08        byte[] buffer = new byte[size];
 09        CodedOutputStream output = new CodedOutputStream(buffer);
 010        model.WriteTo(output);
 011        return buffer;
 12    }
 13
 14    public static T Deserialize<T>(object data) where T : IMessage<T>, new()
 15    {
 016        T ret = new T();
 017        ret.MergeFrom((byte[])data);
 018        return ret;
 19    }
 20}