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."); }
/// <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); }
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"); }
/// <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]); }
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."); }
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); }
/// <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; } }
/// <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; } }
/// <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; } }
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); } }
public override void SetUpdatedValues(FilterViewModel filterViewModel) { Value = filterViewModel.NumericValue; Function = (NumericFunctions)filterViewModel.SelectedMathFunction; }
public NumericFilter(string propertyName, string displayName, double value, NumericFunctions function) : base(propertyName, displayName) { Value = value; Function = function; }