コード例 #1
0
        public NumberValidator(string propertyDisplayName, NumericFunctions functionType, T limitValue)
        {
            _FuntionType = functionType;
            _LimitValue  = System.Convert.ToDouble(limitValue);

            RuleFor((number) => number).Must((number) => CompareValue(number)).WithMessage($"{propertyDisplayName}: el valor no es correcto.");
        }
コード例 #2
0
        /// <summary>
        /// Visits the given input data node.
        /// </summary>
        /// <param name="data">Input data node.</param>
        public override void Visit(InputData.PDDL.EqualsNumericFunctionInitElement data)
        {
            int          functionNameId = IdManager.Functions.GetId(data.Function.Name, data.Function.Terms.Count);
            List <ITerm> terms          = GetTerms(data.Function.Terms);

            NumericFunctions.Add(new Atom(functionNameId, terms), data.Number);
        }
コード例 #3
0
 public void ParseNumberTest()
 {
     Assert.AreEqual(NumericFunctions.ParseNumber("10.000,00").ToString(), "10000");
     Assert.AreEqual(NumericFunctions.ParseNumber("4,545,021.00").ToString(), "4545021");
     Assert.AreEqual(NumericFunctions.ParseNumber("4.545.021,00").ToString(), "4545021");
     Assert.AreEqual(NumericFunctions.ParseNumber("4.545.021,00").ToString(), "4545021");
     Assert.AreEqual(NumericFunctions.ParseNumber("-21,000.00").ToString(), "-21000");
 }
コード例 #4
0
ファイル: State.cs プロジェクト: PlanningFramework/PAD
 /// <summary>
 /// Returns the value of the given numeric function.
 /// </summary>
 /// <param name="function">Grounded function atom.</param>
 /// <returns>Numeric value.</returns>
 public double GetNumericFunctionValue(IAtom function)
 {
     if (NumericFunctions == null || !NumericFunctions.ContainsKey(function))
     {
         return(NumericFunction.UndefinedValue);
     }
     return(NumericFunctions[function]);
 }
コード例 #5
0
        public NumberValidator(string propertyDisplayName, T lowerLimit, bool inclusiveLowerLimit, T upperLimit, bool inclusiveUpperLimit)
        {
            _LowerFunctionRange = inclusiveLowerLimit ? NumericFunctions.GreaterOrEqual : NumericFunctions.Greater;
            _UpperFunctionRange = inclusiveUpperLimit ? NumericFunctions.LowerOrEqual : NumericFunctions.Lower;
            _LowerValue         = System.Convert.ToDouble(lowerLimit);
            _UpperValue         = System.Convert.ToDouble(upperLimit);

            RuleFor((number) => number).Must((number) => CompareRange(number)).WithMessage($"{propertyDisplayName}: el valor no está en el rango esperado.");
        }
コード例 #6
0
        public void addTest1020(int x, int y, int expectedOutput)
        {
            // Arrange
            NUnitTestingDemo.NumericFunctions numericFunctions = new NumericFunctions();
            // Act
            int res = numericFunctions.add(x, y);

            // Assert
            Assert.That(expectedOutput, Is.EqualTo(res));
            Assert.AreEqual(expectedOutput, res);
        }
コード例 #7
0
ファイル: State.cs プロジェクト: PlanningFramework/PAD
        /// <summary>
        /// Scale-down the value of the requested numeric function by the specified value.
        /// </summary>
        /// <param name="function">Requested numeric function.</param>
        /// <param name="value">Value to be scaled-down by.</param>
        public void ScaleDownNumericFunction(IAtom function, double value)
        {
            CheckNumericFunctionsInitialized();

            if (!NumericFunctions.ContainsKey(function))
            {
                NumericFunctions[function] = 0.0;
            }
            else
            {
                NumericFunctions[function] /= value;
            }
        }
コード例 #8
0
ファイル: State.cs プロジェクト: PlanningFramework/PAD
        /// <summary>
        /// Decrease the value of the requested numeric function by the specified value.
        /// </summary>
        /// <param name="function">Requested numeric function.</param>
        /// <param name="value">Value to be decreased by.</param>
        public void DecreaseNumericFunction(IAtom function, double value)
        {
            CheckNumericFunctionsInitialized();

            if (!NumericFunctions.ContainsKey(function))
            {
                NumericFunctions[function] = -value;
            }
            else
            {
                NumericFunctions[function] -= value;
            }
        }
コード例 #9
0
ファイル: State.cs プロジェクト: PlanningFramework/PAD
 /// <summary>
 /// Defines a new value for the requested function in the state.
 /// </summary>
 /// <param name="function">Requested function.</param>
 /// <param name="assignment">Value to be assigned.</param>
 public void AssignNumericFunction(IAtom function, double assignment)
 {
     if (NumericFunction.IsValueUndefined(assignment))
     {
         if (NumericFunctions != null && NumericFunctions.ContainsKey(function))
         {
             NumericFunctions.Remove(function);
         }
     }
     else
     {
         CheckNumericFunctionsInitialized();
         NumericFunctions[function] = assignment;
     }
 }
コード例 #10
0
        public void TestingAMethodWhichCallsOtherMethod(
            [Values(1, 2, 3)] int x)

        //public void TestingAMethodWhichCallsOtherMethod(
        //            [Values(1, 2, 3)] int x)
        {
            NUnitTestingDemo.NumericFunctions obj = new NumericFunctions();
            if (obj.CallingSomeotherMethod(x) > 10)
            {
                Assert.AreNotEqual(10, 1);
            }
            else
            {
                Assert.AreNotEqual(10, 1);
            }
        }
コード例 #11
0
 public override void SetUpdatedValues(FilterViewModel filterViewModel)
 {
     Value    = filterViewModel.NumericValue;
     Function = (NumericFunctions)filterViewModel.SelectedMathFunction;
 }
コード例 #12
0
 public NumericFilter(string propertyName, string displayName, double value, NumericFunctions function) :
     base(propertyName, displayName)
 {
     Value    = value;
     Function = function;
 }