Exemplo n.º 1
0
        public void Whaen_LoggedInSuccessfullyAndRememberPasswordIsSite_Then_PasswordIsSaved()
        {
            _model.WikiUrl          = "Foo";
            _model.Username         = "******";
            _model.RememberPassword = RememberPasswordOptions.RememberForSite;

            A.CallTo(() =>
                     _fileUploader.LoginAsync(A <string> ._, A <string> ._, A <SecureString> ._, A <bool> ._))
            .Returns(Task.FromResult(true));

            _model.LoginCommand.Execute(_password);

            A.CallTo(() => _passwordManager.SavePassword(A <string> ._, A <string> ._, A <SecureString> ._))
            .MustHaveHappened(1, Times.Exactly);
        }
Exemplo n.º 2
0
        private void UpdateSavedPassword(SecureString password)
        {
            switch (RememberPassword)
            {
            case RememberPasswordOptions.DoNotRemember:
                _passwordManager.RemovePassword(WikiUrl, Username);
                break;

            case RememberPasswordOptions.RememberForSite:
                _passwordManager.SavePassword(WikiUrl, Username, password);
                break;

            case RememberPasswordOptions.RememberForDomain:
                _passwordManager.SaveDomainPassword(WikiUrl, Username, password);
                break;
            }
        }