public void Append_MoreComplexIntegerValue() { CalculationStack stack = new CalculationStack(); stack.Append(1); stack.Append(2); stack.Append(3); Assert.AreEqual(123, stack.Input.Value); }
public void Erase_IntegerValue() { CalculationStack stack = new CalculationStack(); stack.Append(1); stack.Append(2); stack.Erase(); Assert.AreEqual(1, stack.Input.Value); }
public void Append_LeadingZeroesIntegerValue() { CalculationStack stack = new CalculationStack(); stack.Append(0); stack.Append(0); stack.Append(1); stack.Append(2); stack.Append(3); Assert.AreEqual(123, stack.Input.Value); }
public void Append_DoubleValue() { CalculationStack stack = new CalculationStack(); stack.Append(1); stack.Append(2); stack.Append(3); stack.SetComma(); stack.Append(0); stack.Append(5); stack.Append(1); Assert.AreEqual(123.051, stack.Input.Value); }
public MemoryRecall(CalculationStack calculationStack) : base(calculationStack) { }
public PercentNumber(CalculationStack calculationStack) : base(calculationStack) { }
public Swap(CalculationStack calculationStack) : base(calculationStack) { }
public CalculateAction(CalculationStack stack, CalculationMode mode) { this.stack = stack; this.mode = mode; }
public Erase(CalculationStack calculationStack) : base(calculationStack) { }
public void Erase_ToZero() { CalculationStack stack = new CalculationStack(); stack.Append(1); stack.Append(2); stack.Append(2); stack.Erase(); stack.Erase(); stack.Erase(); stack.Erase(); Assert.AreEqual(0, stack.Input.Value); }
public ChangeSign(CalculationStack calculationStack) : base(calculationStack) { }
public AddTime(CalculationStack calculationStack) : base(calculationStack) { }
public AddNumber(CalculationStack calculationStack) : base(calculationStack) { }
public void Append_SimpleIntegerValue() { CalculationStack stack = new CalculationStack(); stack.Append(1); Assert.AreEqual(1, stack.Input.Value); }
public void Erase_TillZeroAndAppendAgain() { CalculationStack stack = new CalculationStack(); stack.Append(3); stack.SetComma(); stack.Append(0); stack.Append(4); stack.Append(2); stack.Append(1); stack.Erase(); stack.Erase(); stack.Erase(); stack.Erase(); stack.Append(1); stack.Append(4); stack.Append(1); stack.Append(5); Assert.AreEqual(3.1415, stack.Input.Value); }
public AddDate(CalculationStack calculationStack) : base(calculationStack) { }
public Operation(CalculationStack stack) { this.stack = stack; }
public Operation( CalculationStack stack) { this.stack = stack; }
public DivNumber(CalculationStack calculationStack) : base(calculationStack) { }
public Clear(CalculationStack calculationStack) : base(calculationStack) { }
public PowerNumber(CalculationStack calculationStack) : base(calculationStack) { }
public MemoryMinus(CalculationStack calculationStack) : base(calculationStack) { }
public SubDate(CalculationStack calculationStack) : base(calculationStack) { }
public Enter(CalculationStack calculationStack) : base(calculationStack) { }
public SqrtNumber(CalculationStack calculationStack) : base(calculationStack) { }
public SubTime(CalculationStack calculationStack) : base(calculationStack) { }
public static Operation Build(CalculationStack stack, CalculationMode mode, OperationType type) { // Zacznij od sprawdzania operacji ktore sa niezalezne od trybu switch (type) { case OperationType.C: return new Erase(stack); case OperationType.AC: return new Clear(stack); case OperationType.ENTER: return new Enter(stack); case OperationType.POP: return new Pop(stack); case OperationType.SWAP: return new Swap(stack); case OperationType.MC: return new MemoryClear(stack); case OperationType.MR: return new MemoryRecall(stack); case OperationType.Mplus: return new MemoryPlus(stack); case OperationType.Mminus: return new MemoryMinus(stack); } if (mode == CalculationMode.Date) { switch (type) { case OperationType.SUB: return new SubDate(stack); case OperationType.ADD: return new AddDate(stack); } } if (mode == CalculationMode.Time) { switch (type) { case OperationType.SUB: return new SubTime(stack); case OperationType.ADD: return new AddTime(stack); } } switch (type) { case OperationType.SQRT: return new SqrtNumber(stack); case OperationType.POW: return new PowerNumber(stack); case OperationType.INV_X: return new InvertNumber(stack); case OperationType.PLUS_MINUS: return new ChangeSign(stack); case OperationType.PERCENT: return new PercentNumber(stack); case OperationType.DIV: return new DivNumber(stack); case OperationType.MUL: return new MulNumber(stack); case OperationType.SUB: return new SubNumber(stack); case OperationType.ADD: return new AddNumber(stack); } return null; }
public ViewModelCalculator() { calculationStack = new CalculationStack(); createCalculateCommand(); calculationStack.PropertyChanged += StackChanged; }
public static Operation Build(CalculationStack stack, CalculationMode mode, OperationType type) { // Zacznij od sprawdzania operacji ktore sa niezalezne od trybu switch (type) { case OperationType.C: return(new Erase(stack)); case OperationType.AC: return(new Clear(stack)); case OperationType.ENTER: return(new Enter(stack)); case OperationType.POP: return(new Pop(stack)); case OperationType.SWAP: return(new Swap(stack)); case OperationType.MC: return(new MemoryClear(stack)); case OperationType.MR: return(new MemoryRecall(stack)); case OperationType.Mplus: return(new MemoryPlus(stack)); case OperationType.Mminus: return(new MemoryMinus(stack)); } if (mode == CalculationMode.Date) { switch (type) { case OperationType.SUB: return(new SubDate(stack)); case OperationType.ADD: return(new AddDate(stack)); } } if (mode == CalculationMode.Time) { switch (type) { case OperationType.SUB: return(new SubTime(stack)); case OperationType.ADD: return(new AddTime(stack)); } } switch (type) { case OperationType.SQRT: return(new SqrtNumber(stack)); case OperationType.POW: return(new PowerNumber(stack)); case OperationType.INV_X: return(new InvertNumber(stack)); case OperationType.PLUS_MINUS: return(new ChangeSign(stack)); case OperationType.PERCENT: return(new PercentNumber(stack)); case OperationType.DIV: return(new DivNumber(stack)); case OperationType.MUL: return(new MulNumber(stack)); case OperationType.SUB: return(new SubNumber(stack)); case OperationType.ADD: return(new AddNumber(stack)); } return(null); }
public MemoryClear(CalculationStack calculationStack) : base(calculationStack) { }
public Pop(CalculationStack calculationStack) : base(calculationStack) { }
public MulNumber(CalculationStack calculationStack) : base(calculationStack) { }