Write() public method

public Write ( PwDatabase databaseData, IFile databaseFile ) : System.Threading.Tasks.Task
databaseData Metropass.Core.PCL.Model.PwDatabase
databaseFile IFile
return System.Threading.Tasks.Task
        public async Task CanWrite()
        {
            var database = await Scenarios.LoadDatabase(PasswordDatabasePath, PasswordDatabasePassword, null);
            var writer = new Kdb4Writer(new Kdb4HeaderWriter(),
                      new WinRTCrypto(),
                      new MultiThreadedBouncyCastleCrypto(),
                      new SHA256HasherRT(),
                      new GZipFactoryRT());
         //   .database.var file = await Package.Current.InstalledLocation.GetFileAsync(PasswordDatabasePath);

            try
            {

                var temp = await KnownFolders.DocumentsLibrary.GetFileAsync("file.kdbx");
                await temp.DeleteAsync();
            }catch(Exception e)
            {

            }

            var file = await KnownFolders.DocumentsLibrary.CreateFileAsync("file.kdbx");



            await writer.Write(database, new WinRTFile(file));

            await Scenarios.LoadDatabase(file, PasswordDatabasePassword, null);
        }
        public async Task CanWriteKeePassFiles()
        {
            var queryOptions = new QueryOptions(CommonFileQuery.OrderByName, new[] { ".kdbx" });
            queryOptions.FolderDepth = FolderDepth.Shallow;

            var samples = await Package.Current.InstalledLocation.GetFolderAsync("Samples2");
            var query = samples.CreateFileQueryWithOptions(queryOptions);
            IReadOnlyList<StorageFile> fileList = await query.GetFilesAsync();

            

            var writer = new Kdb4Writer(new Kdb4HeaderWriter(),
                      new WinRTCrypto(),
                      new MultiThreadedBouncyCastleCrypto(),
                      new SHA256HasherRT(),
                      new GZipFactoryRT());

            var listOfFails = new List<object>();

            foreach (var file in fileList)
            {
                PwDatabase database = null;
                string lastFileToTry = file.Name;

                await TryCleanup(lastFileToTry);
                try
                {

                    database = await Scenarios.LoadDatabase(file, "password", null);

                    var newFile = await KnownFolders.DocumentsLibrary.CreateFileAsync(lastFileToTry);
                    await writer.Write(database, new WinRTFile(newFile));
                    await Scenarios.LoadDatabase(newFile, "password", null);
                }
                catch (FormatException e)
                {
                    listOfFails.Add(lastFileToTry);
                }
                catch (Exception e)
                {
                    if(Debugger.IsAttached)
                    {
                        Debugger.Break();
                    }
                    Assert.Fail();
                }
                finally
                {
                    //TryCleanup(lastFileToTry);
                }
            }

            Assert.AreEqual(listOfFails.Count(), 7);
        }