Exemple #1
0
        public void SetInteraction_RaisesPropertyChanged()
        {
            var propertyChangedCalls = new List <string>();

            var viewModel   = new SignaturePasswordViewModel(null, new SignaturePasswordWindowTranslation());
            var interaction = new SignaturePasswordInteraction(PasswordMiddleButton.Skip, "");

            viewModel.PropertyChanged += (sender, args) => propertyChangedCalls.Add(args.PropertyName);

            viewModel.SetInteraction(interaction);

            var expectedProperties = new[] { nameof(viewModel.Interaction), nameof(viewModel.Password), nameof(viewModel.CanRemovePassword), nameof(viewModel.CanSkip) };

            CollectionAssert.AreEquivalent(expectedProperties, propertyChangedCalls);
        }
Exemple #2
0
        private SignaturePasswordViewModel BuildViewModel(string expectedPassword = null)
        {
            var signaturePasswordCheck = Substitute.For <ISignaturePasswordCheck>();

            if (expectedPassword != null)
            {
                signaturePasswordCheck.IsValidPassword(Arg.Any <string>(), expectedPassword).Returns(true);
            }

            var viewModel   = new SignaturePasswordViewModel(signaturePasswordCheck, new SignaturePasswordWindowTranslation());
            var interaction = new SignaturePasswordInteraction(PasswordMiddleButton.Skip, "");

            viewModel.SetInteraction(interaction);

            return(viewModel);
        }