Store stacks in the database when running unit tests

If stacks are not stored in the database before they are create()'d,
anything that refers to a stack (e.g. Resources and Events) cannot be added
to the database either, and we get numerous errors in any output logs.

Change-Id: Icd1012455d413aad617486c138fd4507e391bc7b