I meant to mention this in a previous comment: what we really want to test is whether the newly created key (or value) is there when the hive is re-opened (we don't care about implementation details like whether the file size changes). So I'd suggest loading the app key, create a new key, close the app key, then reload it and check that the new key is there.