public void GenerateShardedUUID() { string Id; var generator = new ShardedUUIDGenerator(); ShardedSessionImpl.CurrentSubgraphShardId = new ShardId(13); Id = (string)generator.Generate(null, null); Assert.AreEqual(true, Id.StartsWith("000d")); ShardedSessionImpl.CurrentSubgraphShardId = new ShardId(32767); //short MaxValue Id = (string)generator.Generate(null, null); Assert.AreEqual(true, Id.StartsWith("7fff")); }
public void GetEncodedShardId() { string Id; var generator = new ShardedUUIDGenerator(); ShardedSessionImpl.CurrentSubgraphShardId = new ShardId(25); Id = (string)generator.Generate(null, null); Assert.AreEqual(new ShardId(25), generator.ExtractShardId(Id)); ShardedSessionImpl.CurrentSubgraphShardId = new ShardId(599); Id = (string)generator.Generate(null, null); Assert.AreEqual(new ShardId(599), generator.ExtractShardId(Id)); ShardedSessionImpl.CurrentSubgraphShardId = new ShardId(short.MaxValue); Id = (string)generator.Generate(null, null); Assert.AreEqual(new ShardId(short.MaxValue), generator.ExtractShardId(Id)); }