public void GetCellData_WithAnInvalidColumn_ShouldReturnEmptyString() { var column = new TrayTOTP_ColumnProvider(_plugin); var pwEntry = new KeePassLib.PwEntry(true, true); pwEntry.Strings.Set(_plugin.Settings.TOTPSeedStringName, new ProtectedString(false, ValidSeed)); pwEntry.Strings.Set(_plugin.Settings.TOTPSettingsStringName, new ProtectedString(false, ValidSettings)); var actual = column.GetCellData("InvalidColumnName", pwEntry); actual.Should().BeEmpty(); }
public void GetCellDataCode_WithValidSeedAndSettings_ShouldReturnA6DigitCodeWithDuration(bool showTimer, string regex) { _plugin.Settings.TOTPColumnTimerVisible = showTimer; var column = new TrayTOTP_ColumnProvider(_plugin); var pwEntry = new KeePassLib.PwEntry(true, true); pwEntry.Strings.Set(_plugin.Settings.TOTPSeedStringName, new ProtectedString(false, ValidSeed)); pwEntry.Strings.Set(_plugin.Settings.TOTPSettingsStringName, new ProtectedString(false, ValidSettings)); var actual = column.GetCellData("TOTP", pwEntry); actual.Should().MatchRegex(regex); }
public void GetCellDataCode_ShouldReturnExpectedValues(string seed, string settings, string expected) { var column = new TrayTOTP_ColumnProvider(_plugin); var pwEntry = new KeePassLib.PwEntry(true, true); if (seed != null) { pwEntry.Strings.Set(_plugin.Settings.TOTPSeedStringName, new ProtectedString(false, seed)); } if (settings != null) { pwEntry.Strings.Set(_plugin.Settings.TOTPSettingsStringName, new ProtectedString(false, settings)); } var actual = column.GetCellData("TOTP", pwEntry); actual.Should().Be(expected); }