Exemplo n.º 1
0
        public void MemeberShipService_SaveBlankUserName()
        {
            MemeberShipService memeberShipService = new MemeberShipService(_userRepository.Object);

            var results = memeberShipService.SaveNewUser("", "");

            Assert.IsFalse(results);
        }
Exemplo n.º 2
0
        public void MemeberShipService_SaveUserName()
        {
            _userRepository.Setup(s => s.FindUser(It.Is<string>(p => p == "someone"))).Returns((User) null).Verifiable();
            _userRepository.Setup(s => s.AddUser(It.Is<string>(p => p == "someone"), It.IsAny<string>())).Verifiable();
            MemeberShipService memeberShipService = new MemeberShipService(_userRepository.Object);

            var results = memeberShipService.SaveNewUser("someone", "password1");

            Assert.IsTrue(results);
            _userRepository.VerifyAll();
        }
Exemplo n.º 3
0
        public void MemeberShipService_CannotSaveDuplicateUserName()
        {
            _userRepository.Setup(s => s.FindUser(It.Is<string>(p => p == "someone"))).Returns(new User()).Verifiable();
            MemeberShipService memeberShipService = new MemeberShipService(_userRepository.Object);

            var results = memeberShipService.SaveNewUser("someone", "password1");

            Assert.IsFalse(results);
            _userRepository.VerifyAll();
        }