public void TypeMismatchCases(string description, object value)
 {
     Assert.Throws <TypeMismatchException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().SECOND(value);
     });
 }
 public void TypeMismatchCases(string description, object target)
 {
     Assert.Throws <TypeMismatchException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().ERASE(target, erasedTarget => { target = erasedTarget; });
     });
 }
 public void TypeMismatchCases(string description, object value, object[] arguments)
 {
     Assert.Throws <TypeMismatchException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().ERASE(value, arguments);
     });
 }
 public void MinusOneIsLessThanEmpty()
 {
     Assert.Equal(
         true,
         DefaultRuntimeSupportClassFactory.Get().LT(-1, null)
     );
 }
 public void PlusOneIsNotLessThanEmpty()
 {
     Assert.Equal(
         false,
         DefaultRuntimeSupportClassFactory.Get().LT(1, null)
     );
 }
 public void JustBeforeNegativeOverflow()
 {
     Assert.Equal(
         VBScriptConstants.MinCurrencyValue,
         DefaultRuntimeSupportClassFactory.Get().CCUR(VBScriptConstants.MinCurrencyValue)
         );
 }
 public void EmptyIsLessThanPlusOne()
 {
     Assert.Equal(
         true,
         DefaultRuntimeSupportClassFactory.Get().LT(null, 1)
     );
 }
Пример #8
0
 public void DateWithDoublesThatAreNotWithinDateAcceptableRange()
 {
     Assert.Throws <VBScriptOverflowException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().NUM(new DateTime(2015, 1, 25, 17, 16, 0), double.MaxValue);
     });
 }
Пример #9
0
 public void StringRepresentationsOfISODatesAreNotParsed()
 {
     Assert.Throws <TypeMismatchException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().NUM("2015-01-01");
     });
 }
Пример #10
0
 public void Empty()
 {
     Assert.Equal(
         (Int16)0,
         DefaultRuntimeSupportClassFactory.Get().NUM(null)
         );
 }
Пример #11
0
 public void IntegerWithDate()
 {
     Assert.Equal(
         new DateTime(1899, 12, 31), // This is the VBScript "ZeroDate" plus one day (which is what 1 is translated into in order to become a date)
         DefaultRuntimeSupportClassFactory.Get().NUM(1, new DateTime(2015, 1, 22, 20, 11, 5, 0))
         );
 }
Пример #12
0
 public void PseudoNumberWithMultipleDecimalPoints()
 {
     Assert.Throws <TypeMismatchException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().NUM("1.1.0");
     });
 }
 public void OverflowCases(string description, object value)
 {
     Assert.Throws <VBScriptOverflowException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().SECOND(value);
     });
 }
 public void ObjectVariableNotSetCases(string description, object value)
 {
     Assert.Throws <ObjectVariableNotSetException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().SECOND(value);
     });
 }
Пример #15
0
 public void TwoIntegersSeparatedByWhitespace()
 {
     Assert.Throws <TypeMismatchException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().NUM("1 1");
     });
 }
Пример #16
0
 public void StringRepresentationsOfBooleanValuesAreNotParsed()
 {
     Assert.Throws <TypeMismatchException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().NUM("True");
     });
 }
Пример #17
0
 public void PositiveDecimalString()
 {
     Assert.Equal(
         1.2,
         DefaultRuntimeSupportClassFactory.Get().NUM("1.2")
         );
 }
Пример #18
0
 public void Null()
 {
     Assert.Throws <InvalidUseOfNullException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().NUM(DBNull.Value);
     });
 }
 public void NegativeOverflow()
 {
     Assert.Throws <VBScriptOverflowException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().CCUR(VBScriptConstants.MinCurrencyValue - 0.000001m);
     });
 }
Пример #20
0
 public void IntegerWithDecimal()
 {
     Assert.Equal(
         1m,
         DefaultRuntimeSupportClassFactory.Get().NUM(1, 2m)
         );
 }
 public void EmptyIsNotLessThanZero()
 {
     Assert.Equal(
         false,
         DefaultRuntimeSupportClassFactory.Get().LT(null, 0)
     );
 }
Пример #22
0
 public void True()
 {
     Assert.Equal(
         (Int16)(-1),
         DefaultRuntimeSupportClassFactory.Get().NUM(true)
         );
 }
 public void NullComparedToNullIsNull()
 {
     Assert.Equal(
         DBNull.Value,
         DefaultRuntimeSupportClassFactory.Get().LT(DBNull.Value, DBNull.Value)
     );
 }
Пример #24
0
 public void False()
 {
     Assert.Equal(
         (Int16)0,
         DefaultRuntimeSupportClassFactory.Get().NUM(false)
         );
 }
                public void ArrayTargetShouldBeReplacedWithEmptyArray()
                {
                    object target = new object[] { 123 };

                    DefaultRuntimeSupportClassFactory.Get().ERASE(target, erasedTarget => { target = erasedTarget; });
                    Assert.Equal(new object[0], target);
                }
Пример #26
0
 public void BlankString()
 {
     Assert.Throws <TypeMismatchException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().NUM("");
     });
 }
                public void NestedArrayTargetShouldBeReplacedWithEmptyArray()
                {
                    object target = new object[] { new object[] { 123 } };

                    DefaultRuntimeSupportClassFactory.Get().ERASE(target, 0);
                    Assert.Equal(new object[0], ((object[])target)[0]);
                }
Пример #28
0
 public void PositiveIntegerStringWithTrailingWhitespace()
 {
     Assert.Equal(
         12d, // VBScript parses string into Doubles, even if there is no decimal fraction
         DefaultRuntimeSupportClassFactory.Get().NUM("12 ")
         );
 }
 public void SubscriptOutOfRangeCases(string description, object value, object[] arguments)
 {
     Assert.Throws <SubscriptOutOfRangeException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().ERASE(value, arguments);
     });
 }
Пример #30
0
 public void InvalidProcedureCallOrArgumentCases(string description, object value, object firstDayOfWeek)
 {
     Assert.Throws <InvalidProcedureCallOrArgumentException>(() =>
     {
         DefaultRuntimeSupportClassFactory.Get().WEEKDAY(value, firstDayOfWeek);
     });
 }