Beispiel #1
0
        public async Task InvalidUnlockTestAsync(string db, string password, bool hasKey)
        {
            var kdbx     = TestAssets.GetFile(db);
            var unlocker = new KdbxDatabaseCache(Substitute.For <ILogger>(), Substitute.For <IDatabaseFileAccess>());

            var key         = hasKey ? TestAssets.GetFile(Path.ChangeExtension(db, "key")) : null;
            var credentials = new KeePassCredentials(key, password);

            await Assert.ThrowsAsync <InvalidCredentialsException>(async() => await unlocker.UnlockAsync(kdbx, credentials));
        }
Beispiel #2
0
        public async Task UnlockTestAsync(string db, string password, bool hasKey)
        {
            var kdbx     = TestAssets.GetFile(db);
            var unlocker = new KdbxDatabaseCache(Substitute.For <ILogger>(), Substitute.For <IDatabaseFileAccess>());

            var key         = hasKey ? TestAssets.GetFile(Path.ChangeExtension(db, "key")) : null;
            var credentials = new KeePassCredentials(key, password);

            var result = await unlocker.UnlockAsync(kdbx, credentials);

            Assert.NotNull(result);
            Assert.Equal(result.Id, kdbx.IdFromPath());
        }