public void When_Trying_To_Authenticate_The_Client_And_ThereIsNoSharedSecret_Then_Null_Is_Returned() { var authenticateInstruction = new AuthenticateInstruction { ClientSecretFromAuthorizationHeader = "notCorrectClientSecret" }; var firstClient = new Client { Secrets = null }; var secondClient = new Client { Secrets = new[] { new ClientSecret { Type = ClientSecretTypes.X509Thumbprint } } }; Assert.Null(authenticateInstruction.AuthenticateClient(firstClient)); Assert.Null(authenticateInstruction.AuthenticateClient(secondClient)); }
public void When_Trying_To_Authenticate_The_Client_And_Credentials_Are_Not_Correct_Then_Null_Is_Returned() { var authenticateInstruction = new AuthenticateInstruction { ClientSecretFromAuthorizationHeader = "notCorrectClientSecret" }; var client = new Client { Secrets = new[] { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "not_correct" } } }; var result = authenticateInstruction.AuthenticateClient(client); Assert.Null(result); }
public void When_Trying_To_Authenticate_The_Client_And_OneParameter_Is_Null_Then_Exception_Is_Thrown() { var authenticateInstruction = new AuthenticateInstruction(); Assert.Throws <NullReferenceException>(() => authenticateInstruction.AuthenticateClient(null)); }