2017-11-23 15:26:57 +01:00
|
|
|
|
using System;
|
|
|
|
|
using ModernKeePass.Interfaces;
|
|
|
|
|
using ModernKeePass.ViewModels;
|
|
|
|
|
using ModernKeePassLib;
|
|
|
|
|
using ModernKeePassLib.Cryptography.KeyDerivation;
|
|
|
|
|
using ModernKeePassLib.Keys;
|
|
|
|
|
using Windows.Storage;
|
|
|
|
|
|
|
|
|
|
namespace ModernKeePassApp.Test.Mock
|
|
|
|
|
{
|
2018-02-23 18:09:21 +01:00
|
|
|
|
public class DatabaseServiceMock : IDatabaseService
|
2017-11-23 15:26:57 +01:00
|
|
|
|
{
|
2018-01-08 18:52:03 +01:00
|
|
|
|
private bool _isOpen;
|
2018-03-09 18:06:06 +01:00
|
|
|
|
private CompositeKey _compositeKey;
|
2018-06-21 11:13:40 +02:00
|
|
|
|
private StorageFile _databaseFile;
|
2017-11-23 15:26:57 +01:00
|
|
|
|
|
2018-06-21 11:13:40 +02:00
|
|
|
|
public PwCompressionAlgorithm CompressionAlgorithm { get; set; }
|
|
|
|
|
|
2017-11-23 15:26:57 +01:00
|
|
|
|
public PwUuid DataCipher { get; set; }
|
|
|
|
|
|
|
|
|
|
public KdfParameters KeyDerivation { get; set; }
|
|
|
|
|
|
2018-02-23 18:09:21 +01:00
|
|
|
|
public bool IsOpen => _isOpen;
|
|
|
|
|
|
|
|
|
|
public bool HasChanged { get; set; }
|
2018-01-08 18:52:03 +01:00
|
|
|
|
|
2017-11-23 15:26:57 +01:00
|
|
|
|
public string Name => "MockDatabase";
|
|
|
|
|
|
2020-04-01 12:48:36 +02:00
|
|
|
|
public GroupDetailVm RecycleBin { get; set; }
|
2017-11-23 15:26:57 +01:00
|
|
|
|
|
|
|
|
|
public bool RecycleBinEnabled { get; set; }
|
|
|
|
|
|
2020-04-01 12:48:36 +02:00
|
|
|
|
public GroupDetailVm RootGroup { get; set; }
|
2018-01-08 18:52:03 +01:00
|
|
|
|
|
2017-11-23 15:26:57 +01:00
|
|
|
|
public void AddDeletedItem(PwUuid id)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2018-01-08 18:52:03 +01:00
|
|
|
|
|
2018-06-18 15:39:01 +02:00
|
|
|
|
public void Close(bool releaseFile = true)
|
2017-11-23 15:26:57 +01:00
|
|
|
|
{
|
2018-06-18 15:39:01 +02:00
|
|
|
|
_isOpen = false;
|
2017-11-23 15:26:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-21 16:40:04 +02:00
|
|
|
|
public void UpdateCompositeKey(CompositeKey newCompositeKey)
|
|
|
|
|
{
|
|
|
|
|
_compositeKey = newCompositeKey;
|
|
|
|
|
}
|
2018-09-07 18:16:40 +02:00
|
|
|
|
|
2018-03-12 17:30:03 +01:00
|
|
|
|
public void CreateRecycleBin(string title)
|
2017-11-23 15:26:57 +01:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2018-06-21 11:13:40 +02:00
|
|
|
|
|
|
|
|
|
public void Open(StorageFile databaseFile, CompositeKey key, bool createNew = false)
|
2017-11-23 15:26:57 +01:00
|
|
|
|
{
|
2018-06-21 11:13:40 +02:00
|
|
|
|
_databaseFile = databaseFile;
|
2018-03-09 18:06:06 +01:00
|
|
|
|
_compositeKey = key;
|
2018-06-18 15:39:01 +02:00
|
|
|
|
_isOpen = true;
|
2017-11-23 15:26:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-18 15:39:01 +02:00
|
|
|
|
public void ReOpen()
|
2018-03-09 18:06:06 +01:00
|
|
|
|
{
|
2018-06-21 11:13:40 +02:00
|
|
|
|
Open(_databaseFile, _compositeKey);
|
2018-03-09 18:06:06 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-23 19:02:49 +01:00
|
|
|
|
public void Save()
|
2017-11-23 15:26:57 +01:00
|
|
|
|
{
|
2017-12-18 18:53:42 +01:00
|
|
|
|
// Do Nothing
|
2017-11-23 15:26:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-23 19:02:49 +01:00
|
|
|
|
public void Save(StorageFile file)
|
2017-11-23 15:26:57 +01:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|