Esempio n. 1
0
        public void Init_GivenSetupWithIntegerValue_ReturnsSettedValues()
        {
            // Arrange
            ConditionType    expectedConditionType   = ConditionType.IsoCountryCode;
            Operators        expectedOperator        = Operators.NotEqual;
            int              expectedOperand         = 1616;
            LogicalOperators expectedLogicalOperator = LogicalOperators.Eval;
            DataTypes        expectedDataType        = DataTypes.Integer;

            IntegerConditionNode <ConditionType> sut = new IntegerConditionNode <ConditionType>(expectedConditionType, expectedOperator, expectedOperand);

            // Act
            ConditionType    actualConditionType   = sut.ConditionType;
            Operators        actualOperator        = sut.Operator;
            DataTypes        actualDataType        = sut.DataType;
            LogicalOperators actualLogicalOperator = sut.LogicalOperator;
            int actualOperand = sut.Operand;

            // Assert
            actualConditionType.Should().Be(expectedConditionType);
            actualOperator.Should().Be(expectedOperator);
            actualOperand.Should().Be(expectedOperand);
            actualLogicalOperator.Should().Be(expectedLogicalOperator);
            actualDataType.Should().Be(expectedDataType);
        }
Esempio n. 2
0
        public void Init_GivenSetupWithStringValue_ReturnsSettedValues()
        {
            // Arrange
            ConditionType    expectedConditionType   = ConditionType.IsoCountryCode;
            Operators        expectedOperator        = Operators.NotEqual;
            string           expectedOperand         = "Such operand, much wow.";
            LogicalOperators expectedLogicalOperator = LogicalOperators.Eval;
            DataTypes        expectedDataType        = DataTypes.String;

            StringConditionNode <ConditionType> sut = new StringConditionNode <ConditionType>(expectedConditionType, expectedOperator, expectedOperand);

            // Act
            ConditionType    actualConditionType   = sut.ConditionType;
            Operators        actualOperator        = sut.Operator;
            DataTypes        actualDataType        = sut.DataType;
            LogicalOperators actualLogicalOperator = sut.LogicalOperator;
            string           actualOperand         = sut.Operand;

            // Assert
            actualConditionType.Should().Be(expectedConditionType);
            actualOperator.Should().Be(expectedOperator);
            actualOperand.Should().Be(expectedOperand);
            actualLogicalOperator.Should().Be(expectedLogicalOperator);
            actualDataType.Should().Be(expectedDataType);
        }
        public void Init_GivenSetupWithDecimalValue_ReturnsSettedValues()
        {
            // Arrange
            ConditionType    expectedConditionType   = ConditionType.PluviosityRate;
            Operators        expectedOperator        = Operators.NotEqual;
            decimal          expectedOperand         = 5682.2654m;
            LogicalOperators expectedLogicalOperator = LogicalOperators.Eval;
            DataTypes        expectedDataType        = DataTypes.Decimal;

            DecimalConditionNode <ConditionType> sut = new DecimalConditionNode <ConditionType>(expectedConditionType, expectedOperator, expectedOperand);

            // Act
            ConditionType    actualConditionType   = sut.ConditionType;
            Operators        actualOperator        = sut.Operator;
            DataTypes        actualDataType        = sut.DataType;
            LogicalOperators actualLogicalOperator = sut.LogicalOperator;
            decimal          actualOperand         = sut.Operand;

            // Assert
            actualConditionType.Should().Be(expectedConditionType);
            actualOperator.Should().Be(expectedOperator);
            actualOperand.Should().Be(expectedOperand);
            actualLogicalOperator.Should().Be(expectedLogicalOperator);
            actualDataType.Should().Be(expectedDataType);
        }
        public void ComposedConditionNode_Init_GivenSetupWithChildConditionsAndLogicalOperator_ReturnsSettedValues()
        {
            // Arrange
            LogicalOperators expectedLogicalOperator = LogicalOperators.Eval;
            IEnumerable <IConditionNode <ConditionType> > expectedChildConditionNodes = new IConditionNode <ConditionType>[]
            {
                new Mock <IConditionNode <ConditionType> >().Object,
                new Mock <IConditionNode <ConditionType> >().Object
            };

            ComposedConditionNode <ConditionType> sut = new ComposedConditionNode <ConditionType>(expectedLogicalOperator, expectedChildConditionNodes);

            // Act
            LogicalOperators actualLogicalOperator = sut.LogicalOperator;
            IEnumerable <IConditionNode <ConditionType> > actualChildConditionNodes = sut.ChildConditionNodes;

            // Assert
            actualLogicalOperator.Should().Be(expectedLogicalOperator);
            actualChildConditionNodes.Should().NotBeNull().And.BeSameAs(expectedChildConditionNodes);
        }