public void Equals_ReadRequest()
        {
            var request = new ReadRequest
            {
                Table       = "Foo",
                Columns     = { "Col1", "Col2" },
                Index       = "Bar",
                Limit       = 10,
                Session     = "sessionName",
                Transaction = new TransactionSelector
                {
                    Id = ByteString.CopyFrom("some_id", Encoding.UTF8)
                }
            };
            var request2   = request.Clone();
            var request3   = new ReadRequest();
            var partition1 = new CommandPartition(ReadOrQueryRequest.FromRequest(request));
            var partition2 = new CommandPartition(ReadOrQueryRequest.FromRequest(request2));
            var partition3 = new CommandPartition(ReadOrQueryRequest.FromRequest(request3));
            var partition4 = new CommandPartition(ReadOrQueryRequest.FromRequest(new ExecuteSqlRequest()));

            Assert.Equal(partition1, partition2);
            Assert.NotEqual(partition1, partition3);
            Assert.NotEqual(partition1, partition4);
            Assert.NotEqual(partition3, partition4);
            Assert.Equal(partition1, partition1.Clone());
        }
        public void Base64RoundTrip_ExecuteSqlRequest()
        {
            var request = new ExecuteSqlRequest
            {
                Sql         = "Test Sql",
                Session     = "sessionName",
                Transaction = new TransactionSelector
                {
                    Id = ByteString.CopyFrom("some_id", Encoding.UTF8)
                }
            };

            var partition  = new CommandPartition(ReadOrQueryRequest.FromRequest(request));
            var partition2 = CommandPartition.FromBase64String(partition.ToBase64String());

            Assert.Equal(request, partition2.Request.ExecuteSqlRequest);
        }
        public void Base64RoundTrip_ReadRequest()
        {
            var request = new ReadRequest
            {
                Table       = "Foo",
                Columns     = { "Col1", "Col2" },
                Index       = "Bar",
                Limit       = 10,
                Session     = "sessionName",
                Transaction = new TransactionSelector
                {
                    Id = ByteString.CopyFrom("some_id", Encoding.UTF8)
                }
            };

            var partition  = new CommandPartition(ReadOrQueryRequest.FromRequest(request));
            var partition2 = CommandPartition.FromBase64String(partition.ToBase64String());

            Assert.Equal(request, partition2.Request.ReadRequest);
        }
        public void Equals_ExecuteSqlRequest()
        {
            var request = new ExecuteSqlRequest
            {
                Sql         = "SELECT * FROM Foo",
                Session     = "sessionName",
                Transaction = new TransactionSelector
                {
                    Id = ByteString.CopyFrom("some_id", Encoding.UTF8)
                }
            };
            var request2   = request.Clone();
            var request3   = new ExecuteSqlRequest();
            var partition1 = new CommandPartition(ReadOrQueryRequest.FromRequest(request));
            var partition2 = new CommandPartition(ReadOrQueryRequest.FromRequest(request2));
            var partition3 = new CommandPartition(ReadOrQueryRequest.FromRequest(request3));
            var partition4 = new CommandPartition(ReadOrQueryRequest.FromRequest(new ReadRequest()));

            Assert.Equal(partition1, partition2);
            Assert.NotEqual(partition1, partition3);
            Assert.NotEqual(partition1, partition4);
            Assert.NotEqual(partition3, partition4);
            Assert.Equal(partition1, partition1.Clone());
        }