Exemple #1
0
        public void IsInvalidWhenPositive()
        {
            //Arrange
            var attribute = new PositiveDecimalAttribute();

            //Act
            var result = attribute.IsValid(5M);

            //Assert
            Assert.True(result);
        }
Exemple #2
0
        public void IsInvalidWhenParameterIsNotDecimal()
        {
            //Arrange
            var attribute = new PositiveDecimalAttribute();

            //Act
            var result = attribute.IsValid(5);

            //Assert
            Assert.False(result);
        }
Exemple #3
0
        public void Should_ReturnFalse_When_ValueEmpty()
        {
            var actualValidationResult = new PositiveDecimalAttribute().IsValid(null);

            Assert.IsFalse(actualValidationResult);
        }
Exemple #4
0
        public void Should_ReturnTrue_When_PositiveDecimalValue()
        {
            var actualValidationResult = new PositiveDecimalAttribute().IsValid(1.23m);

            Assert.IsTrue(actualValidationResult);
        }
Exemple #5
0
        public void Should_ReturnFalse_When_NegativeDecimalValue()
        {
            var actualValidationResult = new PositiveDecimalAttribute().IsValid(-1.23m);

            Assert.IsFalse(actualValidationResult);
        }