コード例 #1
0
ファイル: IntFieldTest.cs プロジェクト: ivanmds/FormBuilder
        public void IntField_IsRequiresTrue_ResultFalse()
        {
            //arrange
            IntFieldBuilder  intField      = new IntFieldBuilder("value_test", isRequired: true);
            IntFieldResponse fieldResponse = new IntFieldResponse(intField);

            //act
            ValidationResult result = fieldResponse.Validate();

            //assert
            Assert.False(result.IsValid, "Regras do IsRequires não estão ok.");
        }
コード例 #2
0
ファイル: IntFieldTest.cs プロジェクト: ivanmds/FormBuilder
        public void IntField_MinValue_ResultFalse(int value)
        {
            //arrange
            IntFieldBuilder  intField      = new IntFieldBuilder("value_test", minValue: 2);
            IntFieldResponse fieldResponse = new IntFieldResponse(intField);

            fieldResponse.SetValue(value);

            //act
            ValidationResult result = fieldResponse.Validate();

            //assert
            Assert.False(result.IsValid, "Regras do MinValue não estão ok.");
        }
コード例 #3
0
ファイル: IntFieldTest.cs プロジェクト: ivanmds/FormBuilder
        public void TextField_CreateNewField_ResultTrue(int value)
        {
            //arrange
            IntFieldBuilder  intField      = new IntFieldBuilder("value_test", 5, 10, true);
            IntFieldResponse fieldResponse = new IntFieldResponse(intField);

            fieldResponse.SetValue(value);

            //act
            ValidationResult result = fieldResponse.Validate();

            //assert
            Assert.True(result.IsValid, "Regras do MinValue não estão ok.");
        }
コード例 #4
0
ファイル: IntFieldTest.cs プロジェクト: ivanmds/FormBuilder
        public void IntField_Success()
        {
            //arrange
            IntFieldBuilder  intField      = new IntFieldBuilder("idade", 10, 20, false);
            IntFieldResponse fieldResponse = new IntFieldResponse(intField);

            fieldResponse.SetValue(12);

            //act
            ValidationResult result = fieldResponse.Validate();

            //assert
            Assert.True(result.IsValid, "Regras não estão ok.");
        }