In the course " Unit Testing for C# Developers", the Stack exercise, Mosh uses two separate methods to test the Stack.Pop and Stack.Peek methods.
One to verify that the result is the last item added to the stack and the second method verifies the number of items in the stack.
Is it allowed to combine the two Asserts in one method like:
[Test]
public void Pop_StackWithObjects_ReturnTopObjectAndRemoveTopObject()
{
_stack.Push("a");
_stack.Push("b");
_stack.Push("c");
var result = _stack.Pop();
Assert.That(result, Is.EqualTo("c"));
Assert.That(_stack.Count, Is.EqualTo(2));
}
If not, why not?