Beispiel #1
0
        public void TestRoundtripRedisValue()
        {
            Random r = new Random();

            for (int machineIdIndex = 0; machineIdIndex < 2048; machineIdIndex++)
            {
                long   randomSize = (long)Math.Pow(2, 63 * r.NextDouble());
                byte[] entryBytes = ContentLocationEntry.ConvertSizeAndMachineIdToRedisValue(randomSize, new MachineId(machineIdIndex));

                var deserializedEntry = ContentLocationEntry.FromRedisValue(entryBytes, DateTime.UtcNow, missingSizeHandling: true);
                deserializedEntry.ContentSize.Should().Be(randomSize);
                deserializedEntry.Locations[machineIdIndex].Should().BeTrue();
            }
        }
 /// <nodoc />
 protected ContentLocationEntry ToContentLocationEntry(RedisValue contentHashInfo)
 {
     return(ContentLocationEntry.FromRedisValue(contentHashInfo, _clock.UtcNow));
 }