Пример #1
0
        public void BuildMenuItemsForRootDropDown_ShouldReturnEntryMenuItems_IfThereIsOnlyASingleDatabase()
        {
            var pwDocument = new PwDocument().New().WithNonTotpEntries(2).WithTotpEnabledEntries(4);

            var sut = _trayMenuItemProvider.BuildMenuItemsForRootDropDown(pwDocument.AsList()).ToList();

            sut.Count.Should().Be(4,
                                  "because, the items are added directly to the root tray menuitem if there is only a single database opened.");
        }
Пример #2
0
        public void BuildMenuItemsForRootDropDown_ShouldCreateASingleMenuItemWithLocked_IfASingleLockedDatabasesIsPresent()
        {
            var pwDocument = new PwDocument().New().Locked();

            var sut = _trayMenuItemProvider.BuildMenuItemsForRootDropDown(pwDocument.AsList()).ToList();

            sut.Count.Should().Be(1);
            sut.First().Text.Should().Contain("[" + Localization.Strings.Locked + "]", "because, there is only a locked database.");
        }
Пример #3
0
        public void BuildMenuItemsForRootDropDown_ShouldReturnEntryMenuItemsNotInRecycleBin()
        {
            var pwDocument = new PwDocument().New().WithNonTotpEntries(2).WithTotpEnabledEntries(4).WithDeletedTotpEnabledEntries(2);

            var sut = _trayMenuItemProvider.BuildMenuItemsForRootDropDown(pwDocument.AsList()).ToList();

            sut.Count.Should().Be(4,
                                  "because, valid entries in the recycle bin should not show up.");
        }
Пример #4
0
        public void BuildMenuItemsForRootDropDown_ShouldReturnCorrectInfo_IfThereAreNoTotpEntries()
        {
            var pwDocument = new PwDocument().New().WithNonTotpEntries(4);

            var sut = _trayMenuItemProvider.BuildMenuItemsForRootDropDown(pwDocument.AsList()).ToList();

            sut.Count.Should().Be(1);
            sut.First().Text.Should().Contain(Localization.Strings.NoTOTPEntriesFound,
                                              "because, there were no totp entries found in the database.");
        }
Пример #5
0
        public void BuildMenuItemsForRootDropDown_ShouldReturnCorrectMenuItem_IfNoDatabaseIsOpened()
        {
            var pwDocument = new PwDocument();

            var sut = _trayMenuItemProvider.BuildMenuItemsForRootDropDown(pwDocument.AsList()).ToList();

            sut.Count.Should().Be(1);
            sut.First().Text.Should().Be(Localization.Strings.NoDatabaseIsOpened,
                                         "because, there is no open database. (KeePass always provides a (new) PwDocument, even if there is no database open.");
        }
Пример #6
0
        public void BuildMenuItemsForRootDropDown_ShouldCreateDisabledMenuItems_IfTotpSettingsNotValid()
        {
            var pwDocument = new PwDocument().New().WithFaultyTotpEnabledEntries(2);

            var sut = _trayMenuItemProvider.BuildMenuItemsForRootDropDown(pwDocument.AsList()).ToList();

            sut.Count.Should().Be(2);
            sut.Should().OnlyContain(s => !s.Enabled,
                                     "because all entries contain invalid settings and can't be used");
        }
Пример #7
0
        public void BuildMenuItemsForRootDropDown_ShouldReturnEntryMenuItems_WhenRecycleBinNotEnabled()
        {
            var pwDocument = new PwDocument().New().WithNonTotpEntries(2).WithTotpEnabledEntries(4).WithDeletedTotpEnabledEntries(2);

            // Treat recycle bin as a regular folder
            pwDocument.Database.RecycleBinEnabled = false;

            var sut = _trayMenuItemProvider.BuildMenuItemsForRootDropDown(pwDocument.AsList()).ToList();

            sut.Count.Should().Be(6,
                                  "because, the recycle bin is treated as a regular folder.");
        }