public void ThrowExceptionIfInnerAdviceCannotBeBuild() { //Arrange var testInvocation = new TestInvocation(); var sut = new LazyAdvice <TestAdviceWithoutParameterlessConstructor>(() => null); //Act + Assert Expect.WillThrow <CannotInstantiateAdviceException>(() => sut.ApplyAdvice(testInvocation), e => e.Message.Contains(typeof(TestAdviceWithoutParameterlessConstructor).Name)); }
public void CreateAndCallProceedOfInnerAdvice() { //Arrange var testInvocation = new TestInvocation(); var mockedAdvice = new Mock <IAdvice>(); var sut = new LazyAdvice <IAdvice>(() => mockedAdvice.Object); //Act sut.ApplyAdvice(testInvocation); //Assert mockedAdvice.Verify(x => x.ApplyAdvice(testInvocation), Times.Once()); }