Пример #1
0
        public void ItShouldBePossibleToImplicitlyCastPositiveDecimalToNonNegativeDecimal()
        {
            var value = Extensions.GetValue(() => PositiveDecimal.TryCreate(1, (NonEmptyString)"Value"));
            NonNegativeDecimal castResult = value;

            castResult.ShouldBeOfType <NonNegativeDecimal>();
        }
Пример #2
0
        public void PositiveDecimalCannotBeCreatedFromNullValue()
        {
            var result = PositiveDecimal.TryCreate(null, (NonEmptyString)"Value");

            result.IsSuccess.ShouldBeFalse();
        }
Пример #3
0
        public void PositiveDecimalCannotBeCreatedFromZeroOrNegativeValue([Values(-1, 0)] decimal value)
        {
            var result = PositiveDecimal.TryCreate(value, (NonEmptyString)"Value");

            result.IsSuccess.ShouldBeFalse();
        }
Пример #4
0
        public void PositiveDecimalCanBeCreatedFromPosititiveValue()
        {
            var result = PositiveDecimal.TryCreate(1, (NonEmptyString)"Value");

            result.IsSuccess.ShouldBeTrue();
        }