public void TestLoadEditSave()
        {
            //create the default database:
            IKp2aApp app = SetupAppWithDefaultDatabase();

            IOConnection.DeleteFile(new IOConnectionInfo {
                Path = DefaultFilename
            });
            //save it and reload it so we have a base version
            SaveDatabase(app);
            _testCacheSupervisor.AssertNoCall();
            app = LoadDatabase(DefaultFilename, DefaultPassword, DefaultKeyfile);
            _testCacheSupervisor.AssertSingleCall(TestCacheSupervisor.LoadedFromRemoteInSyncId);
            //modify the database by adding a group:
            app.GetDb().KpDatabase.RootGroup.AddGroup(new PwGroup(true, true, "TestGroup", PwIcon.Apple), true);
            //save the database again:
            SaveDatabase(app);
            Assert.IsNull(((TestKp2aApp)app).LastYesNoCancelQuestionTitle);
            _testCacheSupervisor.AssertNoCall();

            //load database to a new app instance:
            IKp2aApp resultApp = LoadDatabase(DefaultFilename, DefaultPassword, DefaultKeyfile);

            //ensure the change was saved:
            AssertDatabasesAreEqual(app.GetDb().KpDatabase, resultApp.GetDb().KpDatabase);
        }
        public void TestOpenNonExistingNonCachedFiles()
        {
            SetupFileStorage();

            //read the file once. Should now be in the cache.
            try
            {
                MemoryStream fileContents = ReadToMemoryStream(_fileStorage, "nonexistingfile.txt");
            }
            catch (Exception e)
            {
                _testCacheSupervisor.AssertNoCall();
                Assert.IsInstanceOfType(e, typeof(FileNotFoundException));

                return;
            }
            _testCacheSupervisor.AssertNoCall();
            Assert.Fail("didn't get exception!");
        }