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);
 }
Ejemplo n.º 5
0
 public MemoryRecall(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 6
0
 public PercentNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 7
0
 public Swap(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 8
0
 public MemoryRecall(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 9
0
 public CalculateAction(CalculationStack stack, CalculationMode mode)
 {
     this.stack = stack;
     this.mode  = mode;
 }
Ejemplo n.º 10
0
 public PercentNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 11
0
 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);
 }
Ejemplo n.º 13
0
 public ChangeSign(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 14
0
 public ChangeSign(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 15
0
 public AddTime(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 16
0
 public AddNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
 public void Append_SimpleIntegerValue()
 {
     CalculationStack stack = new CalculationStack();
     stack.Append(1);
     Assert.AreEqual(1, stack.Input.Value);
 }
Ejemplo n.º 18
0
 public Swap(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
        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);
        }
Ejemplo n.º 20
0
 public AddDate(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 21
0
 public Operation(CalculationStack stack)
 {
     this.stack = stack;
 }
Ejemplo n.º 22
0
 public Erase(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 23
0
 public Operation( CalculationStack stack)
 {
     this.stack = stack;
 }
Ejemplo n.º 24
0
 public DivNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 25
0
 public Clear(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 26
0
 public PowerNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 27
0
 public MemoryMinus(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 28
0
 public SubDate(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 29
0
 public Enter(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 30
0
 public SqrtNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 31
0
 public SubTime(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 32
0
        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;
        }
Ejemplo n.º 33
0
 public Clear(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 34
0
 public SqrtNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 35
0
 public ViewModelCalculator()
 {
     calculationStack = new CalculationStack();
     createCalculateCommand();
     calculationStack.PropertyChanged += StackChanged;
 }
Ejemplo n.º 36
0
        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);
        }
Ejemplo n.º 37
0
 public MemoryClear(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 38
0
 public MemoryMinus(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 39
0
 public AddDate(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 40
0
 public AddNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 41
0
 public CalculateAction(CalculationStack stack, CalculationMode mode)
 {
     this.stack = stack;
     this.mode = mode;
 }
Ejemplo n.º 42
0
 public Pop(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 43
0
 public DivNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 44
0
 public Enter(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 45
0
 public SubTime(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 46
0
 public Pop(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 47
0
 public ViewModelCalculator()
 {
     calculationStack = new CalculationStack();
     createCalculateCommand();
     calculationStack.PropertyChanged += StackChanged;
 }
Ejemplo n.º 48
0
 public MulNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }
Ejemplo n.º 49
0
 public MulNumber(CalculationStack calculationStack)
     : base(calculationStack)
 {
 }