Пример #1
0
            public void Should_Return2InValidPasswordCount_When_2InValid()
            {
                var pwEntry1 = new PasswordEntry {
                    Password = "******", PwPolicy = new PasswordPolicy {
                        Letter = 'a', Position1 = 1, Position2 = 2
                    }
                };                                                                                                                              // not valid
                var pwEntry2 = new PasswordEntry {
                    Password = "******", PwPolicy = new PasswordPolicy {
                        Letter = 'a', Position1 = 1, Position2 = 2
                    }
                };                                                                                                                              // not valid
                var pwEntry3 = new PasswordEntry {
                    Password = "******", PwPolicy = new PasswordPolicy {
                        Letter = 'b', Position1 = 1, Position2 = 3
                    }
                };
                var pwEntries = new List <PasswordEntry> {
                    pwEntry1, pwEntry2, pwEntry3
                };

                var sut        = new PasswordReportService(pwEntries);
                var validCount = sut.NumberOfValidPasswords();

                Assert.That(validCount == 1);
            }
Пример #2
0
            public void Should_ReturnFalse_When_InValidPassword(string passwordEntryAsString, bool expectedValid)
            {
                var passwordRepository = new PasswordRepositoryTestWrapper();
                var passwordEntry      = passwordRepository.PasswordEntryFromFileLine(passwordEntryAsString);

                var sut         = new PasswordReportService();
                var actualValid = sut.ValidatePassword(passwordEntry);

                Assert.That(actualValid == expectedValid);
            }