Beispiel #1
0
        public void CalculateShouldSetEmptyPasswordValueWithNoCalculator()
        {
            const string UserName = "******";
            ICredentials target = new Credentials(UserName);

            target.Calculate();

            Assert.AreEqual(target.Password, string.Empty);
        }
Beispiel #2
0
        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();
        }