static void TestLimitedIntegerRange(BigInteger value, BitWidthAndSignPair signAndBitwidth) { var ltdInt = LimitedIntegerType.CreateLimitedIntegerType(value, null); ltdInt.Value.Should().Be(value); ltdInt.IsSigned.Should().Be(signAndBitwidth.IsSigned); ltdInt.BitWidth.Should().Be(signAndBitwidth.BitWidth); }
protected override TNewType InternalCastTo <TNewType>(IConfiguration configuration) { switch (typeof(TNewType).Name) { case nameof(TimespanType): return(new TimespanType(TimeSpan.FromSeconds((double)Value)) as TNewType); case nameof(FloatType): return(new FloatType((double)Value) as TNewType); case nameof(LimitedIntegerType): return(LimitedIntegerType.CreateLimitedIntegerType(Value, configuration) as TNewType); } return(null); }
public void OutOfRangeLimitedIntegers(string value) => new Action(() => LimitedIntegerType.CreateLimitedIntegerType(BigInteger.Parse(value), null)).Should().Throw <TypeConversionException>();