public void CheckBuilder() { PartitionKey key = PartitionKey.From(42, "toto"); Assert.IsNotNull(key); Assert.IsNotNull(key.Keys); Assert.AreEqual(new object[] { 42, "toto" }, key.Keys); }
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)); }
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)); }
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)); }
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); }
public void FailIfNullParam() { Assert.Throws <ArgumentException>(() => PartitionKey.From(null)); }
public void FailIfEmptyParam() { Assert.Throws <ArgumentException>(() => PartitionKey.From()); }