Example #1
0
        public void CheckBuilder()
        {
            PartitionKey key = PartitionKey.From(42, "toto");

            Assert.IsNotNull(key);
            Assert.IsNotNull(key.Keys);
            Assert.AreEqual(new object[] { 42, "toto" }, key.Keys);
        }
Example #2
0
        public void CheckSingleKey()
        {
            IPartitioner partitioner  = new Murmur3Partitioner();
            PartitionKey partitionKey = PartitionKey.From(0x12345678);
            BigInteger?  token        = partitioner.ComputeToken(partitionKey);

            Assert.IsTrue(token.HasValue);
            Assert.IsTrue(token.Value == new BigInteger(-8827056344306985898));
        }
Example #3
0
        public void CheckCompositeKey2()
        {
            IPartitioner partitioner  = new Murmur3Partitioner();
            PartitionKey partitionKey = PartitionKey.From((long)18653, 1, 200711);
            BigInteger?  token        = partitioner.ComputeToken(partitionKey);

            Assert.IsTrue(token.HasValue);
            Assert.IsTrue(token.Value == new BigInteger(-2403361283253792854));
        }
Example #4
0
        public void CheckCompositeKey1()
        {
            IPartitioner partitioner  = new Murmur3Partitioner();
            PartitionKey partitionKey = PartitionKey.From((long)1, 1, 200301);
            BigInteger?  token        = partitioner.ComputeToken(partitionKey);

            Assert.IsTrue(token.HasValue);
            Assert.IsTrue(token.Value == new BigInteger(2268761313986801232));
        }
Example #5
0
        public void CheckNoToken()
        {
            IPartitioner partitioner = new NullPartitioner();

            PartitionKey key   = PartitionKey.From(1);
            BigInteger?  token = partitioner.ComputeToken(key);

            Assert.IsNull(token);

            key   = PartitionKey.From("toto", 42);
            token = partitioner.ComputeToken(key);
            Assert.IsNull(token);
        }
Example #6
0
 public void FailIfNullParam()
 {
     Assert.Throws <ArgumentException>(() => PartitionKey.From(null));
 }
Example #7
0
 public void FailIfEmptyParam()
 {
     Assert.Throws <ArgumentException>(() => PartitionKey.From());
 }