public static bool AuthenticationCodeModalPrompt(TargetUri targetUri, GitHubAuthenticationResultType resultType, string username, out string authenticationCode) { var twoFactorViewModel = new TwoFactorViewModel(resultType == GitHubAuthenticationResultType.TwoFactorSms); Git.Trace.WriteLine($"prompting user for authentication code for '{targetUri}'."); bool authenticationCodeValid = ShowViewModel(twoFactorViewModel, () => new TwoFactorWindow()); authenticationCode = authenticationCodeValid ? twoFactorViewModel.AuthenticationCode : null; return authenticationCodeValid; }
public void IsValid_IsTrueWhenAuthenticationCodeIsSixCharacters() { var vm = new TwoFactorViewModel(); vm.AuthenticationCode = "012345"; Assert.IsTrue(vm.IsValid); }
public void IsValid_IsFalseWhenAuthenticationCodeIsLessThanSixCharacters() { var vm = new TwoFactorViewModel(); vm.AuthenticationCode = "01234"; Assert.IsFalse(vm.IsValid); }