Q:

C# Basic stack arithmetic operations

I have two classes one Calculator and another Test class. Test class contains multiple expected output test and calculator contains method to perform arithmetic operation my question is: Why does TestOne output 105 instead of 9 and TestTwo output 6 instead of 2.
Here are the tests.
public void TestOne()
{
    var c= new Calc();
    c.Add(5);
    c.Add(7);
    c.Undo();
    c.Subtract(2);
    c.Multiply(7);
    c.Undo();
    c.Multiply(3);
}

public void TestTwo()
{
    var c= new Calc();
    c.Add(2);
    c.Add(3);
    c.Add(4);
    ex.Undo();
    c.RepeatLastCommand();
}

Here are the functionalities of the application
public class Calc
{
    int total= 0;
    Stack<int> stack = new Stack<int>();

    public int Value
    {
        get { return total; }
        set { total= value; }
    }

    public void Add(int value)
    { 
        total = total + value;
        stack.Push(value); 
    }

    public void Subtract(int value)
    {
        total = total - value;
        stack.Push(total);
    }

    public void Multiply(int value)
    {
        total= total * value;
        stack.Push(total);
    }

    public void RepeatLastCommand()
    {
        int topOfStack =stack.Peek();
        total += topOfStack;
     }

     public void Undo()
     {
         total = stack.Pop();
         if (stack.Count > 0)
         {
             int safe = stack.Pop();
          }
     }
}

A:

At first glance you need to change your Undo method to
public void Undo()
{
    if(stack.Count > 0 ) stack.Pop();
    total = stack.Peek();
}

also the Add method should Push on the stack the Total variable not the value passed 
public void Add(int value)
{
    total = total + value;
    stack.Push(total);
}

However resolving the RepeatLastCommand operation is a bit more complext and cannot be achieved with this structure, you need to store in your stack variable also the operation executed and the value used in that operation.
I think that the solution presented in another answer by csdp000 could drive you on the right track. 
Regarding instead your request to clarify the change in the Undo, it is simple. The Pop operation extracts from the top of the stack the value that you have last Push(ed), this value is the current total, you are interested to restore the previous value so discard the actual top and assign to total the new top of the stack
EDIT
After some thinking about the RepeatLastAction I have rewritten your class to store, instead of an integer an instance of a class that contains all the information about the operation executed by your Calc class
public class Calc
{
    bool undoAction = false;
    int total = 0;
    Stack<CalcAction> stack = new Stack<CalcAction>();

    public int Value
    {
        get
        {
            return total;
        }
        set
        {
            total = value;
        }
    }

    public void Add(int value)
    {
        CalcAction act = new CalcAction() 
        { 
            operation = Add, 
            actionTotal = total + value, 
            actionValue = value 
        };
        total = act.actionTotal;
        stack.Push(act);
        undoAction = false;
    }

    public void Subtract(int value)
    {
        CalcAction act = new CalcAction()
        {
            operation = Subtract,
            actionTotal = total - value,
            actionValue = value
        };
        total = act.actionTotal;
        stack.Push(act);
        undoAction = false;
    }

    public void Multiply(int value)
    {
        CalcAction act = new CalcAction()
        {
            operation = Multiply,
            actionTotal = total * value,
            actionValue = value
        };
        total = act.actionTotal;
        stack.Push(act);
        undoAction = false;
    }

    public void RepeatLastCommand()
    {
        if (stack.Count > 0)
        {
            if(undoAction)
                Undo();
            else
            {
                CalcAction act = stack.Peek();
                act.operation(act.actionValue);
            }
        }
    }

    public void Undo()
    {
        if (stack.Count > 0) stack.Pop();
        total = ((CalcAction)stack.Peek()).actionTotal;
        undoAction = true;
    }

    internal class CalcAction
    {
        public Action<int> operation;
        public int actionValue;
        public int actionTotal;
    }
}

Here the main change is the internal class CalcAction that is stored in the stack with the info on the current operation. This allows the RepeatLastAction method to know which operation to re-execute. The only exception is the Undo operation that is kept out from the stack because its signature is different from the Add/Subtract/Multiply

