public void GetPriorityTest_CorrectEqualityPriority(ArithmeticSign signPriority, ArithmeticSign signPriorityOther) { int actualPriority = signPriority.GetPriority(); int actualPriorityOther = signPriorityOther.GetPriority(); Assert.IsTrue(actualPriority == actualPriorityOther, $"Sign priority: {signPriority} == {signPriorityOther}"); }
public void GetPriorityTest_CorrectJuniorPriority(ArithmeticSign signLoverPriority, ArithmeticSign signHigherPriority) { int actualLoverPriority = signLoverPriority.GetPriority(); int actualHigherPriority = signHigherPriority.GetPriority(); Assert.IsTrue(actualLoverPriority < actualHigherPriority, $"Sign priority: {signLoverPriority} < {actualHigherPriority}"); }
private static ArithmeticSignAttribute GetArithmeticSignAttribute(this ArithmeticSign enumElement) { Type type = enumElement.GetType(); MemberInfo[] memInfo = type.GetMember(enumElement.ToString()); if (memInfo.Length > 0) { object[] attrs = memInfo[0].GetCustomAttributes(typeof(ArithmeticSignAttribute), false); if (attrs.Length > 0) { return(attrs[0] as ArithmeticSignAttribute); } } throw new NullReferenceException("The sign has no ArithmeticSign attribute"); }
public void GetArithmeticSignTypeTest_CorrectArithmeticSign(char symbolSign, ArithmeticSign expectedSign) { var actualSign = ArithmeticSignHelpers.GetArithmeticSignType(symbolSign); Assert.AreEqual(expectedSign, actualSign, $"Sign: {actualSign} != {expectedSign}"); }
public void EqualsSignTest_CorrectValue(ArithmeticSign sign, char symbolSign, bool expectedValue) { bool actualValue = sign.EqualsSign(symbolSign); Assert.AreEqual(expectedValue, actualValue, $"Sign {sign} != {symbolSign}"); }
public void GetSignTest_CorrectSign(ArithmeticSign sign, char expectedSign) { char actualSign = sign.GetSign(); Assert.AreEqual(expectedSign, actualSign, $"Invalid sign received: {expectedSign}"); }
public NestedExpression(int index, IList <ITerm> expression, ArithmeticSign sign = ArithmeticSign.Sum) { this.Index = index; this.Sign = sign; this.Expression = expression; }
public ExpressionTerm(ArithmeticSign sign) { this.Sign = sign; this.Expression = new List <ITerm>(); }
public ExpressionTerm(ArithmeticSign sign, IList <ITerm> expression) { this.Sign = sign; this.Expression = expression; }
public static char GetSign(this ArithmeticSign enumElement) { ArithmeticSignAttribute arithmeticSign = GetArithmeticSignAttribute(enumElement); return(arithmeticSign.Sign); }
public static bool EqualsSign(this ArithmeticSign enumElement, char symbol) { return(symbol.Equals(enumElement.GetSign())); }
public static int GetPriority(this ArithmeticSign enumElement) { ArithmeticSignAttribute arithmeticSign = GetArithmeticSignAttribute(enumElement); return(arithmeticSign.Priority); }
public NumberTerm(ArithmeticSign sign, decimal digit) { this.Sign = sign; this.Digit = digit; }