public void calculateTestEmptystringArray() { FirstValue value = new FirstValue(); string[] values = new string[10]; Assert.AreEqual(0, value.calculate(values, 2)); }
public void Calculate(decimal firstNumber, decimal secondNumber, string selectedOperator) { FirstValue.SendKeys(firstNumber.ToString()); SecondValue.SendKeys(secondNumber.ToString()); Operator.SendKeys(selectedOperator.ToString()); GoButton.Click(); }
public void calculateTestEmptyList() { FirstValue value = new FirstValue(); List <double> list_values = new List <double>(); Assert.AreEqual(0, value.calculate(list_values)); }
public bool Evaluate(MessageDataItem dataItem) { Variant firstValue = FirstValue.GetValue(dataItem); string message = null; switch (firstValue.Type) { case VariantType.Boolean: message = firstValue.BooleanValue.ToString(); break; case VariantType.DateTime: message = firstValue.DateTimeValue.ToString("o"); break; case VariantType.Float: message = firstValue.FloatValue.ToString(); break; case VariantType.Int: message = firstValue.IntValue.ToString(); break; case VariantType.String: message = firstValue.StringValue; break; } if (Operator == RegExExpressionOperator.Matches) { return(RegularExpressions.Evaluate(message)); } if (Operator == RegExExpressionOperator.NotMatches) { return(!RegularExpressions.Evaluate(message)); } return(false); }
public void calculateTestWithValuesinStringArrayWithPosOutOfRange() { FirstValue value = new FirstValue(); string[] values = new string[2]; values[0] = "sceneId"; values[1] = "10.2"; Assert.AreEqual(0, value.calculate(values, -1)); }
public void calculateTestWithCorrectValuesinStringArray() { FirstValue value = new FirstValue(); string[] values = new string[2]; values[0] = "sceneId"; values[1] = "10.2"; Assert.AreEqual(10.2, value.calculate(values, 1)); }
public void calculateTestWithValuesinList() { FirstValue value = new FirstValue(); List <double> list_values = new List <double>(); list_values.Add(10.2); list_values.Add(20.2); list_values.Add(30.2); Assert.AreEqual(10.2, value.calculate(list_values)); }
public void checkvalue() { if (FirstValue.Text == "") { MessageBox.Show("Please enter an number"); FirstValue.Focus(); } else if (SecondValue.Text == "") { MessageBox.Show("Please enter an number"); SecondValue.Focus(); } }
public override string HintText() { if (First?.Item == null && Second?.Item == null) { return(""); } if (First?.Item == null) { return($"{FirstFieldName} = {SecondValue?.Replace('\n', ',') ?? ""}"); } else { return($"{SecondFieldName} = {FirstValue?.Replace('\n', ',') ?? ""}"); } }
public override bool Compatible(BuildComponent a, BuildComponent b) { if (a == null || b == null) { return(false); } BuildComponent first, second; if (a.Type == FirstType && b.Type == SecondType) { first = a; second = b; } else if (a.Type == SecondType && b.Type == FirstType) { first = b; second = a; } else { return(true); } if (a.Item == null || b.Item == null) { return(true); } if ((!first.Item?.Specs.ContainsKey(FirstFieldName)) ?? true) { return(false); } if ((!second.Item?.Specs.ContainsKey(SecondFieldName)) ?? true) { return(true); } if (FirstValue == null || SecondValue == null) { return(true); } var secondSpecLines = SecondValue.Split('\n'); return(FirstValue.Split('\n').Any(s => secondSpecLines.Any(l => l.Contains(s)))); }
int IComparable <YahtzeeHandsDownCardInformation> .CompareTo(YahtzeeHandsDownCardInformation other) { if (Color != other.Color) { return(Color.CompareTo(other.Color)); } if (FirstValue != other.FirstValue) { return(FirstValue.CompareTo(other.FirstValue)); } if (SecondValue != other.SecondValue) { return(SecondValue.CompareTo(other.SecondValue)); } return(IsWild.CompareTo(other.IsWild)); }
public bool Evaluate(MessageDataItem dataItem) { Variant firstValue = FirstValue.GetValue(dataItem); Variant secondValue = SecondValue.GetValue(dataItem); switch (Operator) { case SimpleExpressionOperator.Equal: return(firstValue == secondValue); case SimpleExpressionOperator.NotEqual: return(firstValue != secondValue); case SimpleExpressionOperator.Greater: return(firstValue > secondValue); case SimpleExpressionOperator.GreaterEqual: return(firstValue >= secondValue); case SimpleExpressionOperator.Less: return(firstValue < secondValue); case SimpleExpressionOperator.LessEqual: return(firstValue <= secondValue); } return(false); }
public void Parse_ValueDefaultValue_DefaultValueIsSet() { var args = Array.Empty <string>(); var parser = new OptionParser(typeof(TestOptionWithTwoValues)); // Act var options = parser.Parse(args) as TestOptionWithTwoValues; // Assert options .Should() .NotBeNull(); options !.FirstValue .Should() .Be(null); options.SecondValue .Should() .Be("Fallback"); }
public decimal GetResult() { var firstvalue = FirstValue.GetResult(); var secondValue = SecondValue.GetResult(); switch (Operation) { case Operation.Plus: return firstvalue + secondValue; case Operation.Minus: return firstvalue - secondValue; case Operation.Div: return firstvalue / secondValue; case Operation.Multiply: return firstvalue * secondValue; case Operation.DivRem: return firstvalue % secondValue; case Operation.Unknow: throw new Exception("unknown operation"); default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Checks the setted objects for know if are equals /// </summary> /// <returns>True if are equals</returns> public bool AreEquals() { if (FirstValue == null ^ SecondValue == null) { return(false); } else if (FirstValue != null) { MethodInfo specificEquals; if (FirstValue is IEnumerable enumerable) { var elementType = enumerable.AsQueryable().ElementType; var setType = typeof(HashSet <>).MakeGenericType(elementType); var set1 = Activator.CreateInstance(setType, new object[] { FirstValue }); var set2 = Activator.CreateInstance(setType, new object[] { SecondValue }); specificEquals = setType.GetMethod("SetEquals", new Type[] { setType }); if (specificEquals != null && specificEquals.ReturnType == typeof(bool)) { return((bool)specificEquals.Invoke(set1, new object[] { set2 })); } } else { // uses Reflection to check if a Type-specific `Equals` exists... specificEquals = typeof(T).GetMethod("Equals", new Type[] { typeof(T) }); if (specificEquals != null && specificEquals.ReturnType == typeof(bool)) { return((bool)specificEquals.Invoke(FirstValue, new object[] { SecondValue })); } } return(FirstValue.Equals(SecondValue)); } return(false); }
void ConvertCommandExecute() { if (FirstValue.Trim() == null) { MessageBox.Show("You must enter a value.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (FirstLabel == "Arabic") { int number = 0; try { number = int.Parse(FirstValue.Trim()); if (number < 1) { MessageBox.Show("You can not enter a negative value", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { arabic = new Arabic(FirstValue); SecondValue = arabic.ConvertToRoman(number); } } catch (Exception) { MessageBox.Show("You did not enter an arabic number, try again.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } else if (FirstLabel == "Roman") { String number = FirstValue.Trim(); roman = new Roman(FirstValue); SecondValue = roman.ConvertToArabic(); } } }
public bool Evaluate(MessageDataItem dataItem) { Variant firstValue = FirstValue.GetValue(dataItem); if (SecondValue?.Range != null) { switch (Operator) { case InExpressionOperator.In: return(firstValue > SecondValue?.Range.StartValue.GetValue(dataItem) && firstValue < SecondValue?.Range.EndValue.GetValue(dataItem)); case InExpressionOperator.InclusiveIn: return(firstValue >= SecondValue?.Range.StartValue.GetValue(dataItem) && firstValue <= SecondValue?.Range.EndValue.GetValue(dataItem)); case InExpressionOperator.NotIn: return(firstValue <= SecondValue?.Range.StartValue.GetValue(dataItem) && firstValue >= SecondValue?.Range.EndValue.GetValue(dataItem)); case InExpressionOperator.InclusiveNotIn: return(firstValue < SecondValue?.Range.StartValue.GetValue(dataItem) && firstValue > SecondValue?.Range.EndValue.GetValue(dataItem)); } } if (SecondValue.List != null) { switch (Operator) { case InExpressionOperator.In: case InExpressionOperator.InclusiveIn: return(SecondValue.List.Any(x => x?.GetValue(dataItem) == firstValue)); case InExpressionOperator.NotIn: case InExpressionOperator.InclusiveNotIn: return(SecondValue.List.All(x => x?.GetValue(dataItem) != firstValue)); } } return(false); }
/// <summary> /// 返回参数值的字符串形式 /// </summary> /// <returns> </returns> public override string ToString() => IsMultiValue?string.Join(", ", Values) : FirstValue.ToString();
public override string ToString() { return($"[{FirstValue.ToString()}-{LastValue.ToString()}]"); }
/// <summary> /// Gets the variances between the properties/fields of /// the setted objects /// </summary> /// <param name="depth">The depth level to compare the children /// fields/properties of the objects. If the value is 0 or less /// not are reviewed the children fields/properties</param> /// <returns>The found collection of variances</returns> public IEnumerable <IObjectVariance> GetVariances(int depth) => FirstValue?.DetailedCompare(SecondValue, depth, Property) ?? Enumerable.Empty <IObjectVariance>();
public override string ToString() { return(Name + " : " + FirstValue.ToString() + (FirstValue.Equals(SecondValue) ? " == " : " != ") + SecondValue.ToString()); }
private void ClearClick(object sender, EventArgs e) { FirstValue.Clear(); SecondValue.Clear(); Result.Clear(); }
public void Merge(FirstValue Group) { rtnString = Group.rtnString; }
public void SendFirstValue(string value1) { Console.WriteLine("We are starting play with calculator and I insert first value: " + value1); FirstValue.SendKeys(value1); verificationValue1 = Int32.Parse(value1); }