public void Generate_builds_valid_NIP() { var nipGen = new NipGenerator(); for (int i = 0; i < 100; i++) { string nip = nipGen.Generate(); Assert.IsTrue( NipValidator.IsValid(nip), string.Format("Failed nr: [{0}], nip: [{1}]", i, nip)); } }
private void InitializeHotKeys() { _hotKeyManager = new HotKeyManager(); _nipGenerator = new NipGenerator(); _peselGenerator = new PeselGenerator(); _hotKeyManager.RegisterHotKey( KeyModifier.NotSet, Keys.F7, () => { string newNip = _nipGenerator.Generate(); SendKeys.SendWait(newNip); AddNipNumberToHistory(newNip); }); _hotKeyManager.RegisterHotKey( KeyModifier.NotSet, Keys.F8, () => { string newPesel = _peselGenerator.Generate(); SendKeys.SendWait(newPesel); AddPeselNumberToHistory(newPesel); }); _hotKeyManager.RegisterHotKey( KeyModifier.NotSet, Keys.F9, () => { if (!this.IsActive) { this.Visibility = Visibility.Visible; this.Activate(); } }); }