public void PlainTextSignatureMethodDoesNotFetchCertificate() { var repository = new MockRepository(); var consumerStore = repository.DynamicMock <IConsumerStore>(); var signer = repository.StrictMock <IOAuthContextSigner>(); var context = new OAuthContext { ConsumerKey = "key", SignatureMethod = SignatureMethod.PlainText }; using (repository.Record()) { Expect.Call(signer.ValidateSignature(null, null)).IgnoreArguments().Return(true); } using (repository.Playback()) { var inspector = new SignatureValidationInspector(consumerStore, signer); inspector.InspectContext(ProviderPhase.GrantRequestToken, context); } }
public void InvalidSignatureThrows() { var repository = new MockRepository(); var consumerStore = repository.DynamicMock <IConsumerStore>(); var signer = repository.StrictMock <IOAuthContextSigner>(); var context = new OAuthContext { ConsumerKey = "key", SignatureMethod = SignatureMethod.PlainText }; using (repository.Record()) { Expect.Call(signer.ValidateSignature(null, null)).IgnoreArguments().Return(false); } using (repository.Playback()) { var inspector = new SignatureValidationInspector(consumerStore, signer); var ex = Assert.Throws <OAuthException>(() => inspector.InspectContext(ProviderPhase.GrantRequestToken, context)); Assert.Equal("Failed to validate signature", ex.Message); } }