Exemplo n.º 1
0
        public void CreateProxy_AfterExecute_Add()
        {
            // arrange
            var foo     = new Foo();
            var monitor = new DummyProxyMonitor();
            //Assert.Fail(string.Format("LastResult {0}", monitor.AfterExecute_LastResult));
            var target = ProxyBuilder.CreateProxy <IFoo>(
                foo,
                monitor
                );
            // act
            var result = target.Add(2, 3);

            // assert
            monitor.AfterExecute_LastMethodName.Should().Be("Add");
            monitor.AfterExecute_LastResult.Should().Be(5);
        }
Exemplo n.º 2
0
        public void CreateProxy_AfterExecute_MethodWithNoParameters()
        {
            // arrange
            var foo     = new Foo();
            var monitor = new DummyProxyMonitor();
            //Assert.Fail(string.Format("LastResult {0}", monitor.AfterExecute_LastResult));
            var target = ProxyBuilder.CreateProxy <IFoo>(
                foo,
                monitor
                );

            // act
            target.MethodWithNoParameters();
            // assert
            monitor.AfterExecute_LastMethodName.Should().Be("MethodWithNoParameters");
            monitor.AfterExecute_LastResult.Should().Be(null);
        }
Exemplo n.º 3
0
        public void CreateProxy_BeforeExecute_Add()
        {
            // arrange
            var foo     = new Foo();
            var monitor = new DummyProxyMonitor();
            //Assert.Fail(string.Format("LastResult {0}", monitor.AfterExecute_LastResult));
            var target = ProxyBuilder.CreateProxy <IFoo>(
                foo,
                monitor
                );

            // act
            target.Add(2, 3);
            // assert
            monitor.BeforeExecute_LastMethodName.Should().Be("Add");
            monitor.BeforeExecute_LastParameters.Should().Have.SameSequenceAs(
                2, 3);
        }