Наследование: IMembershipBusinessLogic
        public void shouldCheckThatPasswordLenghtIsGreaterThanThreeCharacters()
        {
            var membershipProvider = new MembershipBusinessLogic(new Mock<IUserRepository>().Object);

            var minimumLength = membershipProvider.MinPasswordLength;
            Assert.That(minimumLength, Is.GreaterThan(3));
        }
        public void shouldReturnFalseWhenProvidingWrongPassword()
        {
            var username = "******";
            var userPassword = "******";
            var providedPassword = "******";

            var factory = new MockFactory(MockBehavior.Strict);
            var userRepositoryMock = factory.Create<IUserRepository>();

            userRepositoryMock.Setup(x => x.Get(username)).Returns(new User(username, userPassword));
            var membershipProvider = new MembershipBusinessLogic(userRepositoryMock.Object);
            var loginResult = membershipProvider.ValidateUser(username, providedPassword);

            Assert.That(loginResult, Is.False);
        }
        public void shouldReturnTrueWhenValidating()
        {
            var factory = new MockFactory(MockBehavior.Strict);
            var userRepositoryMock = factory.Create<IUserRepository>();

            var wrongUsername = "******";
            var wrongPassword = "******";
            var existingUsername = "******";
            var existingPassword = "******";

            userRepositoryMock.Setup(x => x.Get(existingUsername)).Returns(new User(existingUsername, existingPassword));
            userRepositoryMock.Setup(x => x.Get(wrongUsername)).Returns((User) null);

            var membershipProvider = new MembershipBusinessLogic(userRepositoryMock.Object);
            var loginSuccessfull = membershipProvider.ValidateUser(existingUsername, existingPassword);

            var loginFailed = membershipProvider.ValidateUser(wrongUsername, wrongPassword);

            Assert.That(loginSuccessfull);
            Assert.That(loginFailed, Is.False);
        }