mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-06-13 22:48:42 +00:00
RPC test
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using Esiur.Core;
|
||||
using Esiur.Data;
|
||||
using Esiur.Protocol;
|
||||
using Esiur.Resource;
|
||||
using Google.Protobuf;
|
||||
using System;
|
||||
namespace Esiur.Tests.RPC.EsiurServer
|
||||
{
|
||||
[Remote("Esiur.Tests.RPC.EsiurServer.Attachment", "")]
|
||||
[Export]
|
||||
public class Attachment : IRecord
|
||||
{
|
||||
[Annotation("", "Byte[]")]
|
||||
public byte[] Data { get; set; }
|
||||
|
||||
[Annotation("", "String")]
|
||||
public string MimeType { get; set; }
|
||||
|
||||
[Annotation("", "String")]
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
var other = obj as Attachment;
|
||||
if (Name != other.Name) return false;
|
||||
if (MimeType != other.MimeType) return false;
|
||||
if (!(Data.SequenceEqual(other.Data))) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Client.SharedModel.Attachment ToShared()
|
||||
{
|
||||
return new Client.SharedModel.Attachment()
|
||||
{
|
||||
Data = Data,
|
||||
MimeType = MimeType,
|
||||
Name = Name,
|
||||
};
|
||||
}
|
||||
|
||||
public Esiur.Tests.RPC.Client.Grpc.Attachment ToGrpc()
|
||||
{
|
||||
return new Esiur.Tests.RPC.Client.Grpc.Attachment()
|
||||
{
|
||||
Data = ByteString.CopyFrom(Data),
|
||||
MimeType = MimeType,
|
||||
Name = Name,
|
||||
};
|
||||
}
|
||||
|
||||
public Echo.ThriftModel.Attachment ToThrift()
|
||||
{
|
||||
return new Echo.ThriftModel.Attachment()
|
||||
{
|
||||
Data = Data,
|
||||
MimeType = MimeType,
|
||||
Name = Name,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user