'Check that the mailbox has the expected number (ten) of messages in it,
and that each has the expected contents, and that they are in the same
order as that in which they were appended.'

def _cbTestAppend(self, ignored, mbox):

    self.assertEqual(len(mbox.listMessages()), 10)
    self.assertEqual([len(mbox.getMessage(i).read()) for i in range(10)], list(range(1, 11)))
    self._setState(None, mbox, rename=False)
    d = self._append(None, mbox)
    d.addCallback(self._setState, mbox, rename=True, write=False)
    d.addCallback(self._append, mbox)
    d.addCallback(self._setState, mbox, write=True, open=False)
    d.addCallback(self._append, mbox)
    d.addCallback(self._setState, mbox, open=True)
    return d
