public void DoesNotReviveNullOrEmptyOrWhiteSpaceOrInvalidOrUnknownOrUnsupportedTypesAndDoesNotThrowException()
        {
            var actualNullValue = ShardKeyValueArgReviver.Revive(null, null);

            Assert.IsNull(actualNullValue);

            var actualEmptyValue = ShardKeyValueArgReviver.Revive(null, "");

            Assert.IsNull(actualEmptyValue);

            var actualWhiteSpaceValue = ShardKeyValueArgReviver.Revive(null, "\t");

            Assert.IsNull(actualWhiteSpaceValue);

            var actualInvalidValue = ShardKeyValueArgReviver.Revive(null, "Invalid|4000");           // Invalid maps to 0 in the enum

            Assert.IsNull(actualInvalidValue);

            var actualUnknownValue = ShardKeyValueArgReviver.Revive(null, "Widget|Sprocket");        // Widget not a real thing

            Assert.IsNull(actualUnknownValue);

            var actualUnsupportedType = ShardKeyValueArgReviver.Revive(null, "Long|2147483648");     // Long not currently supported by Sharding.App (though it is supported by SqlAzure Sharding)

            Assert.IsNull(actualUnsupportedType);
        }
        public void CorrectlyRevivesGuidValueInsideBracesDashesIgnoringCase()
        {
            var expectedGuid            = Guid.Parse("{5A88452F-2534-40d4-a439-1a856e8e4d7a}");
            var actualGuidShardKeyValue = ShardKeyValueArgReviver.Revive(null, $"GUID|{expectedGuid}");

            Assert.IsNotNull(actualGuidShardKeyValue);
            Assert.IsNotNull(actualGuidShardKeyValue.KeyType);
            Assert.IsNotNull(actualGuidShardKeyValue.KeyValue);
            Assert.AreEqual(typeof(Guid), actualGuidShardKeyValue.KeyType);
            Assert.AreEqual(expectedGuid, (Guid)actualGuidShardKeyValue.KeyValue);
        }
        public void CorrectlyRevivesIntValueIgnoringCase()
        {
            const int expectedInt            = 66;
            var       actualIntShardKeyValue = ShardKeyValueArgReviver.Revive(null, $"int|{expectedInt}");

            Assert.IsNotNull(actualIntShardKeyValue);
            Assert.IsNotNull(actualIntShardKeyValue.KeyType);
            Assert.IsNotNull(actualIntShardKeyValue.KeyValue);
            Assert.AreEqual(typeof(int), actualIntShardKeyValue.KeyType);
            Assert.AreEqual(expectedInt, (int)actualIntShardKeyValue.KeyValue);
        }
        public void CorrectlyRevivesGuidValueContainingDashesIgnoringCase()
        {
            var expectedGuid            = Guid.Parse("46975B4A-2d77-4cd9-B559-16E13600FCDB");
            var actualGuidShardKeyValue = ShardKeyValueArgReviver.Revive(null, $"GUID|{expectedGuid}");

            Assert.IsNotNull(actualGuidShardKeyValue);
            Assert.IsNotNull(actualGuidShardKeyValue.KeyType);
            Assert.IsNotNull(actualGuidShardKeyValue.KeyValue);
            Assert.AreEqual(typeof(Guid), actualGuidShardKeyValue.KeyType);
            Assert.AreEqual(expectedGuid, (Guid)actualGuidShardKeyValue.KeyValue);
        }
        public void CorrectlyRevivesGuidValueWithoutDashesIgnoringCase()
        {
            var expectedGuid            = Guid.Parse("661282B387C84f5aa66167D79CB866A3");
            var actualGuidShardKeyValue = ShardKeyValueArgReviver.Revive(null, $"GUID|{expectedGuid}");

            Assert.IsNotNull(actualGuidShardKeyValue);
            Assert.IsNotNull(actualGuidShardKeyValue.KeyType);
            Assert.IsNotNull(actualGuidShardKeyValue.KeyValue);
            Assert.AreEqual(typeof(Guid), actualGuidShardKeyValue.KeyType);
            Assert.AreEqual(expectedGuid, (Guid)actualGuidShardKeyValue.KeyValue);
        }
 public void ThrowsExceptionWhenTypeAndValueAreMismatched()
 {
     ShardKeyValueArgReviver.Revive(null, "guid|126");
 }
 public void ThrowsExceptionWhenFormatIsInvalid()
 {
     ShardKeyValueArgReviver.Revive(null, "int 2000");
 }
 public void ThrowsExceptionWhenTooManyValues()
 {
     ShardKeyValueArgReviver.Revive(null, "Int|100|200");
 }
 public void ThrowsExceptionWhenMissingValue()
 {
     ShardKeyValueArgReviver.Revive(null, "Int|");
 }
 public void ThrowsExceptionWhenMissingType()
 {
     ShardKeyValueArgReviver.Revive(null, "|E47704F6BF2B4950A343BAC47997CC0C");
 }