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_CompleteRegistrationNoUserName() { MemeberShipService memeberShipService = new MemeberShipService(_userRepository.Object); var result = memeberShipService.CompleteRegistration("", "nothing"); Assert.IsFalse(result); }
public void MemeberShipService_CompleteRegistrationSucess() { Device device = _user.DeviceRegistrations.First(); _user.AuthenticationRequest.First().Challenge = _startedRegistration.Challenge; _user.AuthenticationRequest.First().AppId = _startedRegistration.AppId; _userRepository.Setup(e => e.FindUser("test")).Returns(_user); _userRepository.Setup(e => e.RemoveUsersAuthenticationRequests("test")); _userRepository.Setup(e => e.AddDeviceRegistration("Test", device.AttestationCert, Convert.ToUInt32(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.RemoveUsersAuthenticationRequests("test"), Times.Once); _userRepository.Verify(e => e.FindUser("test"), Times.Once); }
public void MemeberShipService_CompleteRegistrationNoDeviceResponse() { MemeberShipService memeberShipService = new MemeberShipService(_userRepository.Object); var result = memeberShipService.CompleteRegistration("test", ""); Assert.IsFalse(result); }