private void ConvertThroughProto(Commands source) { Com.DigitalAsset.Ledger.Api.V1.Commands protoValue = source.ToProto("ledgerId"); Commands target = Commands.FromProto(protoValue); Assert.IsTrue(source == target); }
public static Commands FromProto(Com.DigitalAsset.Ledger.Api.V1.Commands commands) { string commandId = commands.CommandId; string party = commands.Party; return(new Commands(commands.WorkflowId, commands.ApplicationId, commandId, party, commands.LedgerEffectiveTime.ToDateTimeOffset(), commands.MaximumRecordTime.ToDateTimeOffset(), from c in commands.Commands_ select Command.FromProtoCommand(c))); }
public static Com.DigitalAsset.Ledger.Api.V1.Commands ToProto(string ledgerId, string workflowId, string applicationId, string commandId, string party, DateTimeOffset ledgerEffectiveTime, DateTimeOffset maximumRecordTime, IEnumerable <Command> commands) { var c = new Com.DigitalAsset.Ledger.Api.V1.Commands { LedgerId = ledgerId, WorkflowId = workflowId, ApplicationId = applicationId, CommandId = commandId, Party = party, LedgerEffectiveTime = Google.Protobuf.WellKnownTypes.Timestamp.FromDateTimeOffset(ledgerEffectiveTime), MaximumRecordTime = Google.Protobuf.WellKnownTypes.Timestamp.FromDateTimeOffset(maximumRecordTime) }; c.Commands_.AddRange(from command in commands select command.ToProtoCommand()); return(c); }