More refactoring

Added first simple unit test
This commit is contained in:
Philipp Crocoll
2013-06-18 21:12:34 +02:00
parent 8b08baa51a
commit 533c6f207e
23 changed files with 188 additions and 50 deletions

View File

@@ -0,0 +1,54 @@
using System;
using Android.Content;
using KeePassLib.Serialization;
using keepass2android;
namespace Kp2aUnitTests
{
/// <summary>
/// Very simple implementation of the Kp2aApp interface to be used in tests
/// </summary>
internal class TestKp2aApp : IKp2aApp
{
private Database _db;
public void SetShutdown()
{
}
public Database GetDb()
{
return _db;
}
public void StoreOpenedFileAsRecent(IOConnectionInfo ioc, string keyfile)
{
}
public Database CreateNewDatabase()
{
TestDrawableFactory testDrawableFactory = new TestDrawableFactory();
_db = new Database(testDrawableFactory, new TestKp2aApp());
return _db;
}
public string GetResourceString(UiStringKey stringKey)
{
return stringKey.ToString();
}
public bool GetBooleanPreference(PreferenceKey key)
{
return true;
}
public void AskYesNoCancel(UiStringKey titleKey, UiStringKey messageKey, EventHandler<DialogClickEventArgs> yesHandler, EventHandler<DialogClickEventArgs> noHandler,
EventHandler<DialogClickEventArgs> cancelHandler, Context ctx)
{
yesHandler(null, null);
}
}
}