Exemple #1
0
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.squareChatMid)
            {
                hashcode = (hashcode * 397) + SquareChatMid.GetHashCode();
            }
            if (__isset.squareMessage)
            {
                hashcode = (hashcode * 397) + SquareMessage.GetHashCode();
            }
            if (__isset.senderDisplayName)
            {
                hashcode = (hashcode * 397) + SenderDisplayName.GetHashCode();
            }
            if (__isset.unreadCount)
            {
                hashcode = (hashcode * 397) + UnreadCount.GetHashCode();
            }
            if (__isset.requiredToFetchChatEvents)
            {
                hashcode = (hashcode * 397) + RequiredToFetchChatEvents.GetHashCode();
            }
        }
        return(hashcode);
    }
Exemple #2
0
    public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            TField field;
            await iprot.ReadStructBeginAsync(cancellationToken);

            while (true)
            {
                field = await iprot.ReadFieldBeginAsync(cancellationToken);

                if (field.Type == TType.Stop)
                {
                    break;
                }

                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.String)
                    {
                        SquareChatMid = await iprot.ReadStringAsync(cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        SquareMessage = new SquareMessage();
                        await SquareMessage.ReadAsync(iprot, cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                default:
                    await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                    break;
                }

                await iprot.ReadFieldEndAsync(cancellationToken);
            }

            await iprot.ReadStructEndAsync(cancellationToken);
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
Exemple #3
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("SquareEventNotificationMessage(");
        bool __first = true;

        if (SquareChatMid != null && __isset.squareChatMid)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SquareChatMid: ");
            SquareChatMid.ToString(sb);
        }
        if (SquareMessage != null && __isset.squareMessage)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SquareMessage: ");
            SquareMessage.ToString(sb);
        }
        if (SenderDisplayName != null && __isset.senderDisplayName)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SenderDisplayName: ");
            SenderDisplayName.ToString(sb);
        }
        if (__isset.unreadCount)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("UnreadCount: ");
            UnreadCount.ToString(sb);
        }
        if (__isset.requiredToFetchChatEvents)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("RequiredToFetchChatEvents: ");
            RequiredToFetchChatEvents.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
Exemple #4
0
    public override string ToString()
    {
        StringBuilder __sb    = new StringBuilder("SquareEventNotificationMessage(");
        bool          __first = true;

        if (SquareChatMid != null && __isset.squareChatMid)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("SquareChatMid: ");
            __sb.Append(SquareChatMid);
        }
        if (SquareMessage != null && __isset.squareMessage)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("SquareMessage: ");
            __sb.Append(SquareMessage == null ? "<null>" : SquareMessage.ToString());
        }
        if (SenderDisplayName != null && __isset.senderDisplayName)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("SenderDisplayName: ");
            __sb.Append(SenderDisplayName);
        }
        if (__isset.unreadCount)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("UnreadCount: ");
            __sb.Append(UnreadCount);
        }
        if (__isset.requiredToFetchChatEvents)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("RequiredToFetchChatEvents: ");
            __sb.Append(RequiredToFetchChatEvents);
        }
        __sb.Append(")");
        return(__sb.ToString());
    }
    public void Read(TProtocol iprot)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            TField field;
            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.String)
                    {
                        SquareChatMid = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        SquareMessage = new SquareMessage();
                        SquareMessage.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
    public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
    {
        oprot.IncrementRecursionDepth();
        try
        {
            var struc = new TStruct("SquareEventSendMessage");
            await oprot.WriteStructBeginAsync(struc, cancellationToken);

            var field = new TField();
            if (SquareChatMid != null && __isset.squareChatMid)
            {
                field.Name = "squareChatMid";
                field.Type = TType.String;
                field.ID   = 1;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteStringAsync(SquareChatMid, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (SquareMessage != null && __isset.squareMessage)
            {
                field.Name = "squareMessage";
                field.Type = TType.Struct;
                field.ID   = 2;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await SquareMessage.WriteAsync(oprot, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (__isset.reqSeq)
            {
                field.Name = "reqSeq";
                field.Type = TType.I32;
                field.ID   = 3;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteI32Async(ReqSeq, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            await oprot.WriteFieldStopAsync(cancellationToken);

            await oprot.WriteStructEndAsync(cancellationToken);
        }
        finally
        {
            oprot.DecrementRecursionDepth();
        }
    }
Exemple #7
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("SquareEventSendMessage");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (SquareChatMid != null && __isset.squareChatMid)
         {
             field.Name = "squareChatMid";
             field.Type = TType.String;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(SquareChatMid);
             oprot.WriteFieldEnd();
         }
         if (SquareMessage != null && __isset.squareMessage)
         {
             field.Name = "squareMessage";
             field.Type = TType.Struct;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             SquareMessage.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (__isset.reqSeq)
         {
             field.Name = "reqSeq";
             field.Type = TType.I32;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             oprot.WriteI32(ReqSeq);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.squareChatMid)
            {
                hashcode = (hashcode * 397) + SquareChatMid.GetHashCode();
            }
            if (__isset.squareMessage)
            {
                hashcode = (hashcode * 397) + SquareMessage.GetHashCode();
            }
            if (__isset.reqSeq)
            {
                hashcode = (hashcode * 397) + ReqSeq.GetHashCode();
            }
        }
        return(hashcode);
    }
Exemple #9
0
    public override string ToString()
    {
        StringBuilder __sb    = new StringBuilder("SquareEventSendMessage(");
        bool          __first = true;

        if (SquareChatMid != null && __isset.squareChatMid)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("SquareChatMid: ");
            __sb.Append(SquareChatMid);
        }
        if (SquareMessage != null && __isset.squareMessage)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("SquareMessage: ");
            __sb.Append(SquareMessage == null ? "<null>" : SquareMessage.ToString());
        }
        if (__isset.reqSeq)
        {
            if (!__first)
            {
                __sb.Append(", ");
            }
            __first = false;
            __sb.Append("ReqSeq: ");
            __sb.Append(ReqSeq);
        }
        __sb.Append(")");
        return(__sb.ToString());
    }
Exemple #10
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("SquareEventSendMessage(");
        bool __first = true;

        if (SquareChatMid != null && __isset.squareChatMid)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SquareChatMid: ");
            SquareChatMid.ToString(sb);
        }
        if (SquareMessage != null && __isset.squareMessage)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SquareMessage: ");
            SquareMessage.ToString(sb);
        }
        if (__isset.reqSeq)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ReqSeq: ");
            ReqSeq.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
Exemple #11
0
        public void SquareServiceTest()
        {
            var storage = CloudStorage.ForInMemoryStorage().BuildStorageProviders();
            var service = new SquareQueueService {
                Storage = storage, Environment = new MockEnvironment(), Log = NullLog.Instance
            };

            const string containerName = "mockcontainer";

            //filling blobs to be processed.
            for (int i = 0; i < 10; i++)
            {
                storage.BlobStorage.PutBlob(containerName, "blob" + i, (double)i);
            }

            var squareMessage = new SquareMessage
            {
                ContainerName = containerName,
                Expiration    = DateTimeOffset.UtcNow + new TimeSpan(10, 0, 0, 0),
                IsStart       = true
            };

            var queueName = TypeMapper.GetStorageName(typeof(SquareMessage));

            storage.QueueStorage.Put(queueName, squareMessage);

            for (int i = 0; i < 11; i++)
            {
                service.StartService();
            }

            var sum = storage.BlobStorage.ListBlobs <double>(containerName).Sum();

            //0*0+1*1+2*2+3*3+...+9*9 = 285
            Assert.AreEqual(285, sum, "result is different from expected.");
        }
Exemple #12
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("SquareEventNotificationMessage");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         if (SquareChatMid != null && __isset.squareChatMid)
         {
             field.Name = "squareChatMid";
             field.Type = TType.String;
             field.ID   = 1;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(SquareChatMid);
             oprot.WriteFieldEnd();
         }
         if (SquareMessage != null && __isset.squareMessage)
         {
             field.Name = "squareMessage";
             field.Type = TType.Struct;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             SquareMessage.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (SenderDisplayName != null && __isset.senderDisplayName)
         {
             field.Name = "senderDisplayName";
             field.Type = TType.String;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(SenderDisplayName);
             oprot.WriteFieldEnd();
         }
         if (__isset.unreadCount)
         {
             field.Name = "unreadCount";
             field.Type = TType.I32;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             oprot.WriteI32(UnreadCount);
             oprot.WriteFieldEnd();
         }
         if (__isset.requiredToFetchChatEvents)
         {
             field.Name = "requiredToFetchChatEvents";
             field.Type = TType.Bool;
             field.ID   = 5;
             oprot.WriteFieldBegin(field);
             oprot.WriteBool(RequiredToFetchChatEvents);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
Exemple #13
0
    public void Read(TProtocol iprot)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            TField field;
            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.String)
                    {
                        SquareChatMid = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        SquareMessage = new SquareMessage();
                        SquareMessage.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.String)
                    {
                        SenderDisplayName = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I32)
                    {
                        UnreadCount = iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.Bool)
                    {
                        RequiredToFetchChatEvents = iprot.ReadBool();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
    public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            TField field;
            await iprot.ReadStructBeginAsync(cancellationToken);

            while (true)
            {
                field = await iprot.ReadFieldBeginAsync(cancellationToken);

                if (field.Type == TType.Stop)
                {
                    break;
                }

                switch (field.ID)
                {
                case 3:
                    if (field.Type == TType.Struct)
                    {
                        LastMessage = new SquareMessage();
                        await LastMessage.ReadAsync(iprot, cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 4:
                    if (field.Type == TType.String)
                    {
                        SenderDisplayName = await iprot.ReadStringAsync(cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 5:
                    if (field.Type == TType.Struct)
                    {
                        OtherStatus = new SquareChatStatusWithoutMessage();
                        await OtherStatus.ReadAsync(iprot, cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                default:
                    await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                    break;
                }

                await iprot.ReadFieldEndAsync(cancellationToken);
            }

            await iprot.ReadStructEndAsync(cancellationToken);
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
Exemple #15
0
    public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
    {
        oprot.IncrementRecursionDepth();
        try
        {
            var struc = new TStruct("SquareEventNotificationMessage");
            await oprot.WriteStructBeginAsync(struc, cancellationToken);

            var field = new TField();
            if (SquareChatMid != null && __isset.squareChatMid)
            {
                field.Name = "squareChatMid";
                field.Type = TType.String;
                field.ID   = 1;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteStringAsync(SquareChatMid, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (SquareMessage != null && __isset.squareMessage)
            {
                field.Name = "squareMessage";
                field.Type = TType.Struct;
                field.ID   = 2;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await SquareMessage.WriteAsync(oprot, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (SenderDisplayName != null && __isset.senderDisplayName)
            {
                field.Name = "senderDisplayName";
                field.Type = TType.String;
                field.ID   = 3;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteStringAsync(SenderDisplayName, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (__isset.unreadCount)
            {
                field.Name = "unreadCount";
                field.Type = TType.I32;
                field.ID   = 4;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteI32Async(UnreadCount, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            if (__isset.requiredToFetchChatEvents)
            {
                field.Name = "requiredToFetchChatEvents";
                field.Type = TType.Bool;
                field.ID   = 5;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await oprot.WriteBoolAsync(RequiredToFetchChatEvents, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);
            }
            await oprot.WriteFieldStopAsync(cancellationToken);

            await oprot.WriteStructEndAsync(cancellationToken);
        }
        finally
        {
            oprot.DecrementRecursionDepth();
        }
    }
Exemple #16
0
    public async Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            TField field;
            await iprot.ReadStructBeginAsync(cancellationToken);

            while (true)
            {
                field = await iprot.ReadFieldBeginAsync(cancellationToken);

                if (field.Type == TType.Stop)
                {
                    break;
                }

                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.String)
                    {
                        SquareChatMid = await iprot.ReadStringAsync(cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        SquareMessage = new SquareMessage();
                        await SquareMessage.ReadAsync(iprot, cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 3:
                    if (field.Type == TType.String)
                    {
                        SenderDisplayName = await iprot.ReadStringAsync(cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 4:
                    if (field.Type == TType.I32)
                    {
                        UnreadCount = await iprot.ReadI32Async(cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                case 5:
                    if (field.Type == TType.Bool)
                    {
                        RequiredToFetchChatEvents = await iprot.ReadBoolAsync(cancellationToken);
                    }
                    else
                    {
                        await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);
                    }
                    break;

                default:
                    await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken);

                    break;
                }

                await iprot.ReadFieldEndAsync(cancellationToken);
            }

            await iprot.ReadStructEndAsync(cancellationToken);
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }
Exemple #17
0
    public void Read(TProtocol iprot)
    {
        iprot.IncrementRecursionDepth();
        try
        {
            TField field;
            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 3:
                    if (field.Type == TType.Struct)
                    {
                        LastMessage = new SquareMessage();
                        LastMessage.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.String)
                    {
                        SenderDisplayName = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 5:
                    if (field.Type == TType.Struct)
                    {
                        OtherStatus = new SquareChatStatusWithoutMessage();
                        OtherStatus.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
        finally
        {
            iprot.DecrementRecursionDepth();
        }
    }