示例#1
0
        public void When_InsecureConnection_Then_WarningDialogIsShown()
        {
            _model.WikiUrl          = "http://Foo";
            _model.Username         = "******";
            _model.RememberPassword = RememberPasswordOptions.DoNotRemember;

            _model.LoginCommand.Execute(_password);

            A.CallTo(() => _dialogs.ConfirmInsecureLoginDialog())
            .MustHaveHappened(1, Times.Exactly);
        }
示例#2
0
        private async Task <string> Validate()
        {
            if (string.IsNullOrWhiteSpace(WikiUrl) || string.IsNullOrWhiteSpace(Username))
            {
                await _helpers.Wait(500);

                LoginError(Resources.LoginErrorNoWikiOrUsername);
                return(null);
            }

            var url = WikiUrl.ToLowerInvariant();

            if (!url.StartsWith("http://") && !url.StartsWith("https://"))
            {
                url = "https://" + url;
            }

            if (!Uri.IsWellFormedUriString(url, UriKind.Absolute) || url.IndexOf('?') != -1)
            {
                await _helpers.Wait(500);

                LoginError(Resources.LoginErrorInvalidWikiUrl);
                return(null);
            }

            if (url.StartsWith("http://") && !_dialogs.ConfirmInsecureLoginDialog())
            {
                return(null);
            }

            return(url);
        }