Пример #1
0
        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));
        }
Пример #2
0
        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());
        }