public ClientMsgProtobuf <T> ReadAsProtobufMsg <T>() where T : IExtensible, new() { var fileData = File.ReadAllBytes(FileInfo.FullName); var msg = new PacketClientMsgProtobuf(EMsg, fileData); var proto = new ClientMsgProtobuf <T>(msg); return(proto); }
public void ClientMsgAssertsInitializedWithNonProtoMsg() { var packetMsgData = new ClientMsgProtobuf <CMsgClientLogon>(EMsg.ClientLogon).Serialize(); var packetMsg = new PacketClientMsgProtobuf(MsgUtil.MakeMsg(EMsg.ClientLogon, protobuf: true), packetMsgData); var exception = Record.Exception(() => new ClientMsg <MsgClientLogon>(packetMsg)); Assert.NotNull(exception); Assert.IsType <TraceAssertException>(exception); var tae = (TraceAssertException)exception; // Can't nameof(ClientMsg) - nameof doesn't support open generic types (yet). Assert.Contains($"ClientMsg<{typeof( MsgClientLogon ).FullName}>", tae.AssertMessage); }