public void CalculateShouldSetEmptyPasswordValueWithNoCalculator() { const string UserName = "******"; ICredentials target = new Credentials(UserName); target.Calculate(); Assert.AreEqual(target.Password, string.Empty); }
public void CalculateShouldSetPasswordWithUserNameHashCodeValue() { const string Username = "******"; ICredentials credentials = new Credentials(Username); IPasswordGenerator target = new HashPasswordGenerator(); target.Generate(credentials); Assert.AreEqual(Username.GetHashCode().ToString(CultureInfo.InvariantCulture), credentials.Password); }
public void CalculateShouldSetPasswordValueExpectedUsingCalculator() { const string Password = "******"; Mock<IPasswordGenerator> mock = this.MoqRepository.Create<IPasswordGenerator>(); mock.Setup(x => x.Generate(It.IsAny<ICredentials>())) .Callback((ICredentials c) => { c.Password = Password; }); IPasswordGenerator generator = mock.Object; ICredentials credentials = new Credentials(generator, "Me"); credentials.Calculate(); Assert.AreEqual(Password, credentials.Password); mock.Verify(); }