Ejemplo n.º 1
0
        public void EncodingDecodingTest()
        {
            var randomString = RandomValues.RandomString(20);

            Console.WriteLine($"RandomValueTest - RandomString : {randomString}");
            Assert.Equal(20, randomString.Length);
        }
Ejemplo n.º 2
0
 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);
     }
 }
    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);
    }
Ejemplo n.º 4
0
 public static string GetUsername()
 {
     return(string.Format("{0}_{1}", RandomValues.RandomString(6, false), RandomValues.RandomNumber(111, 9999)));
 }