コード例 #1
0
        public void EncodingDecodingTest()
        {
            var randomString = RandomValues.RandomString(20);

            Console.WriteLine($"RandomValueTest - RandomString : {randomString}");
            Assert.Equal(20, randomString.Length);
        }
コード例 #2
0
ファイル: Cryptography.cs プロジェクト: jklebucki/FvpWebApp
 public string Encrypt(string plainPassword)
 {
     if (!string.IsNullOrEmpty(plainPassword))
     {
         return(RandomValues.RandomString(48) + Convert.ToBase64String(Encoding.UTF8.GetBytes(
                                                                           Convert.ToBase64String(Encoding.UTF8.GetBytes(plainPassword))
                                                                           )));
     }
     else
     {
         return(string.Empty);
     }
 }
コード例 #3
0
    public void ApplicationMainPresenterSetUp()
    {
        Mock <IAuthenticationView> authView = new Mock <IAuthenticationView>(MockBehavior.Strict);

        authView.SetupProperty(v => v.ErrorMessage);
        authView.SetupGet(v => v.Instance).Returns(RandomValues.RandomString());
        authView.SetupGet(v => v.Login).Returns(RandomValues.RandomString());
        authView.SetupGet(v => v.Password).Returns(RandomValues.RandomString());
        authView.Setup(v => v.CloseView());
        authView.Setup(v => v.SetTitle(It.IsAny <string>()));
        authView.Setup(v => v.ShowView()).Raises(v => v.OnConnect += null).Verifiable();
        Mock <IMembershipService> authService = new Mock <IMembershipService>(MockBehavior.Loose);

        authService.Setup(s => s.AuthenticateUser(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(true);
        IAuthenticationPresenter authPresenter = new AuthenticationPresenter(authView.Object, authService.Object);

        ApplicationView = new ApplicationForm();
        Presenter       = new ApplicationPresenter(ApplicationView, authPresenter);
    }
コード例 #4
0
ファイル: Clients.aspx.cs プロジェクト: msalah85/c-a-r-s
 public static string GetUsername()
 {
     return(string.Format("{0}_{1}", RandomValues.RandomString(6, false), RandomValues.RandomNumber(111, 9999)));
 }