Suppose I am writing a calculator engine with a class as follows …

```
public class ArithmeticExpression
{
ArithmeticExpression Add(double operand);
ArithmeticExpression Subtract(double operand);
// ... other useful operations like division, multiplication, etc.
double ProduceResult();
}
```

… and the objective is to defer the evaluation of the expression until `ProduceResullt()`

it is called, so that the correct order of all stacked operations is maintained.

### My question is:

How should i deal with **test unit of this class** without being overwhelmed

By the number of combinations of calling methods?

For me it is clear that the order of the calls must be tested in some way, but writing tests like this:

```
public void Multiply_CalledAfterAdd_TakesPrecedenceOverAdd()
{
// ...
}
public void Multiply_CalledAfterDivide_EvaluatesLeftToRight()
{
// ...
}
```

It can go mad and out of control pretty quickly. And it's not even about those 16 tests for the four basic arithmetic functions. Suppose that in the future I decide to extend the calculator with a module operation, for starters, there are 9 almost identical tests.

On the other hand, the entire student of the class must maintain the order of the operations, so it must be verified in some way.

Concluding: I know that the example is trivial, but it is a general problem that I find it difficult to find an answer. Any help is appreciated, thanks.