Ejemplo n.º 1
0
        public void DoesNotReviveNullOrEmptyOrWhiteSpaceOrInvalidOrUnknownOrUnsupportedTypesAndDoesNotThrowException()
        {
            var actualNullValue = ShardKeyRangeArgReviver.Revive(null, null);

            Assert.IsNull(actualNullValue);

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

            Assert.IsNull(actualEmptyValue);

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

            Assert.IsNull(actualWhiteSpaceValue);

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

            Assert.IsNull(actualInvalidValue);

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

            Assert.IsNull(actualUnknownValue);

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

            Assert.IsNull(actualUnsupportedType);
        }
Ejemplo n.º 2
0
        public void CorrectlyRevivesIntRangeIgnoringCase()
        {
            const int expectedLowValue  = 100;
            const int expectedHighValue = 300;

            var actualIntRange = ShardKeyRangeArgReviver.Revive(null, $"INT|{expectedLowValue},{expectedHighValue}");

            Assert.IsNotNull(actualIntRange);
            Assert.IsNotNull(actualIntRange.KeyType);
            Assert.IsNotNull(actualIntRange.LowValue);
            Assert.IsNotNull(actualIntRange.HighValue);

            Assert.AreEqual(typeof(int), actualIntRange.KeyType);
            Assert.AreEqual(expectedLowValue, (int)actualIntRange.LowValue);
            Assert.AreEqual(expectedHighValue, (int)actualIntRange.HighValue);
        }
Ejemplo n.º 3
0
 public void ThrowsExceptionWhenMissingLowValue()
 {
     ShardKeyRangeArgReviver.Revive(null, "int|,9000");
 }
Ejemplo n.º 4
0
 public void ThrowsExceptionWhenMissingValues()
 {
     ShardKeyRangeArgReviver.Revive(null, "int|");
 }
Ejemplo n.º 5
0
 public void ThrowsExceptionWhenMissingType()
 {
     ShardKeyRangeArgReviver.Revive(null, "|15000,16000");
 }
Ejemplo n.º 6
0
 public void ThrowsExceptionWhenValuesAreMismatchedTypes()
 {
     ShardKeyRangeArgReviver.Revive(null, "guid|C9E34B32E0F7468C8D4C525232D11F0C,2700");
 }
Ejemplo n.º 7
0
 public void ThrowsExceptionWhenTypeAndValueAreMismatched()
 {
     ShardKeyRangeArgReviver.Revive(null, "guid|1600,2000");
 }
Ejemplo n.º 8
0
 public void ThrowsExceptionWhenFormatIsInvalid()
 {
     ShardKeyRangeArgReviver.Revive(null, "int|7500|9000");
 }
Ejemplo n.º 9
0
 public void ThrowsExceptionWhenTooManyValues()
 {
     ShardKeyRangeArgReviver.Revive(null, "int|7500,9000,11250");
 }
Ejemplo n.º 10
0
 public void ThrowsExceptionWhenMissingHighValue()
 {
     ShardKeyRangeArgReviver.Revive(null, "int|7500,");
 }