public void MemeberShipService_CompleteRegistrationNoUserName() { MemeberShipService memeberShipService = new MemeberShipService(_userRepository.Object); var result = memeberShipService.CompleteRegistration("", "nothing"); Assert.IsFalse(result); }
public void MemeberShipService_CompleteRegistrationNoDeviceResponse() { MemeberShipService memeberShipService = new MemeberShipService(_userRepository.Object); var result = memeberShipService.CompleteRegistration("test", ""); Assert.IsFalse(result); }
public void MemeberShipService_CompleteRegistrationUserFoundWithNoAuthenticationRequest() { _userRepository.Setup(e => e.FindUser("test")).Returns(new User()); MemeberShipService memeberShipService = new MemeberShipService(_userRepository.Object); var result = memeberShipService.CompleteRegistration("test", _authenticateResponse.ToJson()); Assert.IsFalse(result); _userRepository.Verify(e => e.FindUser("test"), Times.Once); }
public void MemeberShipService_CompleteRegistrationSucess() { Device device = _user.DeviceRegistrations.First(); _user.AuthenticationRequest.Challenge = _startedRegistration.Challenge; _user.AuthenticationRequest.AppId = _startedRegistration.AppId; _userRepository.Setup(e => e.FindUser("test")).Returns(_user); _userRepository.Setup(e => e.RemoveUsersAuthenticationRequest("test")); _userRepository.Setup(e => e.AddDeviceRegistration("Test", device.AttestationCert, device.Counter, device.KeyHandle, device.PublicKey)); MemeberShipService memeberShipService = new MemeberShipService(_userRepository.Object); var result = memeberShipService.CompleteRegistration("test", _registerResponse.ToJson()); Assert.IsTrue(result); _userRepository.Verify(e => e.RemoveUsersAuthenticationRequest("test"), Times.Once); _userRepository.Verify(e => e.FindUser("test"), Times.Once); }