예제 #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);
        }
예제 #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));
        }
예제 #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));
        }
예제 #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));
        }
예제 #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);
        }
예제 #6
0
 public void FailIfNullParam()
 {
     Assert.Throws <ArgumentException>(() => PartitionKey.From(null));
 }
예제 #7
0
 public void FailIfEmptyParam()
 {
     Assert.Throws <ArgumentException>(() => PartitionKey.From());
 }