mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Corrected some tests
Minor code refactor Main page now correctly shows save page even when opening a DB from Explorer
This commit is contained in:
@@ -393,8 +393,8 @@
|
|||||||
</Page>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
<Reference Include="BouncyCastle.Crypto, Version=1.8.3.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
|
<HintPath>..\packages\Portable.BouncyCastle.1.8.3\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.HockeyApp.Core45, Version=4.1.6.1005, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.HockeyApp.Core45, Version=4.1.6.1005, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
@@ -421,24 +421,24 @@
|
|||||||
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
|
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Composition.AttributedModel, Version=1.0.31.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Composition.AttributedModel, Version=1.0.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Composition.AttributedModel.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
|
<HintPath>..\packages\System.Composition.AttributedModel.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Composition.Convention, Version=1.0.31.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Composition.Convention, Version=1.0.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Composition.Convention.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
|
<HintPath>..\packages\System.Composition.Convention.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Composition.Hosting, Version=1.0.31.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Composition.Hosting, Version=1.0.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Composition.Hosting.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
|
<HintPath>..\packages\System.Composition.Hosting.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Composition.Runtime, Version=1.0.31.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Composition.Runtime, Version=1.0.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Composition.Runtime.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
|
<HintPath>..\packages\System.Composition.Runtime.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Composition.TypedParts, Version=1.0.31.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Composition.TypedParts, Version=1.0.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Composition.TypedParts.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
|
<HintPath>..\packages\System.Composition.TypedParts.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Drawing.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Drawing.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
@@ -62,7 +62,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
Destination = destinationFrame,
|
Destination = destinationFrame,
|
||||||
Parameter = databaseFile,
|
Parameter = databaseFile,
|
||||||
SymbolIcon = Symbol.Page2,
|
SymbolIcon = Symbol.Page2,
|
||||||
IsSelected = databaseFile != null
|
IsSelected = databaseFile != null && !database.IsOpen
|
||||||
},
|
},
|
||||||
new MainMenuItemVm
|
new MainMenuItemVm
|
||||||
{
|
{
|
||||||
|
@@ -13,15 +13,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
|
|
||||||
public StorageFile DatabaseFile { get; private set; }
|
public StorageFile DatabaseFile { get; private set; }
|
||||||
|
|
||||||
public OpenVm() : this(null) { }
|
internal void OpenFile(StorageFile file)
|
||||||
|
|
||||||
public OpenVm(StorageFile file)
|
|
||||||
{
|
|
||||||
if (!IsFileSelected) return;
|
|
||||||
OpenFile(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OpenFile(StorageFile file)
|
|
||||||
{
|
{
|
||||||
OpenFile(file, RecentService.Instance);
|
OpenFile(file, RecentService.Instance);
|
||||||
}
|
}
|
||||||
|
@@ -10,16 +10,16 @@
|
|||||||
<package id="Microsoft.Toolkit.Uwp.Notifications" version="2.0.0" targetFramework="win81" />
|
<package id="Microsoft.Toolkit.Uwp.Notifications" version="2.0.0" targetFramework="win81" />
|
||||||
<package id="ModernKeePassLib" version="2.39.1" targetFramework="win81" />
|
<package id="ModernKeePassLib" version="2.39.1" targetFramework="win81" />
|
||||||
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
|
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
|
||||||
<package id="Portable.BouncyCastle" version="1.8.2" targetFramework="win81" />
|
<package id="Portable.BouncyCastle" version="1.8.3" targetFramework="win81" />
|
||||||
<package id="Splat" version="3.0.0" targetFramework="win81" />
|
<package id="Splat" version="3.0.0" targetFramework="win81" />
|
||||||
<package id="System.Collections" version="4.3.0" targetFramework="win81" />
|
<package id="System.Collections" version="4.3.0" targetFramework="win81" />
|
||||||
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="win81" />
|
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="win81" />
|
||||||
<package id="System.Composition" version="1.0.31" targetFramework="win81" />
|
<package id="System.Composition" version="1.2.0" targetFramework="win81" />
|
||||||
<package id="System.Composition.AttributedModel" version="1.0.31" targetFramework="win81" />
|
<package id="System.Composition.AttributedModel" version="1.2.0" targetFramework="win81" />
|
||||||
<package id="System.Composition.Convention" version="1.0.31" targetFramework="win81" />
|
<package id="System.Composition.Convention" version="1.2.0" targetFramework="win81" />
|
||||||
<package id="System.Composition.Hosting" version="1.0.31" targetFramework="win81" />
|
<package id="System.Composition.Hosting" version="1.2.0" targetFramework="win81" />
|
||||||
<package id="System.Composition.Runtime" version="1.0.31" targetFramework="win81" />
|
<package id="System.Composition.Runtime" version="1.2.0" targetFramework="win81" />
|
||||||
<package id="System.Composition.TypedParts" version="1.0.31" targetFramework="win81" />
|
<package id="System.Composition.TypedParts" version="1.2.0" targetFramework="win81" />
|
||||||
<package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="win81" />
|
<package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="win81" />
|
||||||
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="win81" />
|
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="win81" />
|
||||||
<package id="System.Drawing.Primitives" version="4.3.0" targetFramework="win81" />
|
<package id="System.Drawing.Primitives" version="4.3.0" targetFramework="win81" />
|
||||||
|
@@ -3,21 +3,24 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ModernKeePass.Interfaces;
|
using ModernKeePass.Interfaces;
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace ModernKeePassApp.Test.Mock
|
namespace ModernKeePassApp.Test.Mock
|
||||||
{
|
{
|
||||||
class RecentServiceMock : IRecentService
|
class RecentServiceMock : IRecentService
|
||||||
{
|
{
|
||||||
|
private Dictionary<string, IStorageItem> _recentItems = new Dictionary<string, IStorageItem>();
|
||||||
|
|
||||||
public int EntryCount => 0;
|
public int EntryCount => 0;
|
||||||
|
|
||||||
public void Add(IStorageItem file, string metadata)
|
public void Add(IStorageItem file, string metadata)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_recentItems.Add(metadata, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearAll()
|
public void ClearAll()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_recentItems.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableCollection<IRecentItem> GetAllFiles(bool removeIfNonExistant = true)
|
public ObservableCollection<IRecentItem> GetAllFiles(bool removeIfNonExistant = true)
|
||||||
@@ -27,7 +30,7 @@ namespace ModernKeePassApp.Test.Mock
|
|||||||
|
|
||||||
public Task<IStorageItem> GetFileAsync(string token)
|
public Task<IStorageItem> GetFileAsync(string token)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return Task.Run(() => _recentItems[token]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -159,12 +159,12 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
<Reference Include="BouncyCastle.Crypto, Version=1.8.3.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
|
<HintPath>..\packages\Portable.BouncyCastle.1.8.3\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ModernKeePassLib, Version=2.37.0.2000, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="ModernKeePassLib, Version=2.39.1.22027, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ModernKeePassLib.2.38.2\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
|
<HintPath>..\packages\ModernKeePassLib.2.39.1\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
@@ -63,9 +63,10 @@ namespace ModernKeePassApp.Test
|
|||||||
{
|
{
|
||||||
var databaseFile = Package.Current.InstalledLocation.GetFileAsync(@"Data\TestDatabase.kdbx")
|
var databaseFile = Package.Current.InstalledLocation.GetFileAsync(@"Data\TestDatabase.kdbx")
|
||||||
.GetAwaiter().GetResult();
|
.GetAwaiter().GetResult();
|
||||||
var openVm = new OpenVm(databaseFile);
|
var openVm = new OpenVm();
|
||||||
Assert.IsTrue(openVm.IsFileSelected);
|
Assert.IsFalse(openVm.IsFileSelected);
|
||||||
Assert.AreEqual("MockDatabase", openVm.Name);
|
openVm.OpenFile(databaseFile, new RecentServiceMock());
|
||||||
|
Assert.AreEqual("TestDatabase.kdbx", openVm.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*[TestMethod]
|
/*[TestMethod]
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Microsoft.NETCore.Platforms" version="2.1.0" targetFramework="win81" />
|
<package id="Microsoft.NETCore.Platforms" version="2.1.1" targetFramework="win81" />
|
||||||
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
|
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
|
||||||
<package id="ModernKeePassLib" version="2.38.2" targetFramework="win81" />
|
<package id="ModernKeePassLib" version="2.39.1" targetFramework="win81" />
|
||||||
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
|
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
|
||||||
<package id="Portable.BouncyCastle" version="1.8.2" targetFramework="win81" />
|
<package id="Portable.BouncyCastle" version="1.8.3" targetFramework="win81" />
|
||||||
<package id="Splat" version="3.0.0" targetFramework="win81" />
|
<package id="Splat" version="3.0.0" targetFramework="win81" />
|
||||||
<package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="win81" />
|
<package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="win81" />
|
||||||
<package id="System.Drawing.Primitives" version="4.3.0" targetFramework="win81" />
|
<package id="System.Drawing.Primitives" version="4.3.0" targetFramework="win81" />
|
||||||
|
@@ -23,7 +23,7 @@ namespace ModernKeePassLib.Test.Keys
|
|||||||
"\t\t<Data>";
|
"\t\t<Data>";
|
||||||
|
|
||||||
private const string ExpectedFileEnd = "\t</Key>\r\n" +
|
private const string ExpectedFileEnd = "\t</Key>\r\n" +
|
||||||
"</KeyFile>\r\n";
|
"</KeyFile>";
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestConstruct()
|
public void TestConstruct()
|
||||||
@@ -70,7 +70,7 @@ namespace ModernKeePassLib.Test.Keys
|
|||||||
{
|
{
|
||||||
var fileContents = FileIO.ReadTextAsync(file).GetAwaiter().GetResult();
|
var fileContents = FileIO.ReadTextAsync(file).GetAwaiter().GetResult();
|
||||||
|
|
||||||
Assert.AreEqual(fileContents.Length, 187);
|
Assert.AreEqual(185, fileContents.Length);
|
||||||
Assert.IsTrue(fileContents.StartsWith(ExpectedFileStart));
|
Assert.IsTrue(fileContents.StartsWith(ExpectedFileStart));
|
||||||
Assert.IsTrue(fileContents.EndsWith(ExpectedFileEnd));
|
Assert.IsTrue(fileContents.EndsWith(ExpectedFileEnd));
|
||||||
}
|
}
|
||||||
|
@@ -148,8 +148,12 @@
|
|||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.2.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
<Reference Include="BouncyCastle.Crypto, Version=1.8.3.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
|
<HintPath>..\packages\Portable.BouncyCastle.1.8.3\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="ModernKeePassLib, Version=2.39.1.22027, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\ModernKeePassLib.2.39.1\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
@@ -183,12 +187,6 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\ModernKeePassLib\ModernKeePass.Lib.csproj">
|
|
||||||
<Project>{2e710089-9559-4967-846c-e763dd1f3acb}</Project>
|
|
||||||
<Name>ModernKeePass.Lib</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Microsoft.NETCore.Platforms" version="2.1.0" targetFramework="win81" />
|
<package id="Microsoft.NETCore.Platforms" version="2.1.1" targetFramework="win81" />
|
||||||
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
|
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
|
||||||
<package id="ModernKeePassLib" version="2.38.2" targetFramework="win81" />
|
<package id="ModernKeePassLib" version="2.39.1" targetFramework="win81" />
|
||||||
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
|
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
|
||||||
<package id="Portable.BouncyCastle" version="1.8.2" targetFramework="win81" />
|
<package id="Portable.BouncyCastle" version="1.8.3" targetFramework="win81" />
|
||||||
<package id="Splat" version="3.0.0" targetFramework="win81" />
|
<package id="Splat" version="3.0.0" targetFramework="win81" />
|
||||||
<package id="System.Collections" version="4.3.0" targetFramework="win81" />
|
<package id="System.Collections" version="4.3.0" targetFramework="win81" />
|
||||||
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="win81" />
|
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="win81" />
|
||||||
|
Reference in New Issue
Block a user