Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make Advice consume IMethodAdviceContext instead of MethoadAdviceContext

See original GitHub issue

I have an attribute that consumes IMethodAdvise which I want to test. I’ve tried testing it’s advise method and stepped into a problem:

  1. MethodAdviceContext has not parallel interface to mock by.
  2. some of MethodAdviceContext's Constructor parameters are Internal (and also have not interface) and therefore I cannot instantiate them (and therefore, no testing for me 😦 )

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

shirbr510commented, Jul 9, 2016

Kinda forgot to try it… tried it now and works like charm 😃

again, thank you for listening and making it work 😃

shirbr510commented, Jul 6, 2016

True. I can pass down parameters to anything rather Easely except one case: context.Proceed()

wrapping it is possible but it will look rather close to Microsoft’s HttpContextWrapper solution for the sealed HttpContext (if you know what I’m speaking of), which I personally prefer to avoid

On Wed, Jul 6, 2016 at 6:34 PM, Pascal Craponne wrote:

From the methods above, which ones do you intend to test? If you test only the OnEnter, OnExit and OnException you can simply pass the required MethodAdviceContext properties instead of passing the whole instance. Same thing (a little bit heavier though) if you test the LogMethod, no?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring AOP not working for method call inside another ...
It's a workaround but will do the trick, the key here is to use the same bean (proxy) to invoke 'method2' instead of...
Read more >
Declaring Advice :: Spring Framework
We see how to make argument and other contextual values available to the advice body later in this section. First, we take a...
Read more >
Introduction to Advice Types in Spring
A quick intro to AOP in Spring and working with Advice types to cross-cut across your application concerns.
Read more >
Spring AOP Example Tutorial - Aspect, Advice, Pointcut, ...
It is the responsibility of around advice to invoke the join point method and return values if the method is returning something. We...
Read more >
MrAdvice 2.12.2
Advice allows you to: Advise methods or parameters, at assembly, type, method or parameter level; Advice types (at assembly startup); Introduce fields; Advise...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found