/src/Ninject.Extensions.Interception.Test/DynamicProxy2ChannelFactoryProxyTest.cs
https://github.com/hereyes/ninject.extensions.interception · C# · 37 lines · 31 code · 6 blank · 0 comment · 0 complexity · fcf99b6b537c8964fc5aa7d903782b93 MD5 · raw file
- namespace Ninject.Extensions.Interception
- {
- #if !SILVERLIGHT
- using System.ServiceModel;
- #endif
- using Castle.DynamicProxy;
- using FluentAssertions;
- using Ninject.Extensions.Interception.Fakes;
- using Ninject.Extensions.Interception.Infrastructure.Language;
- using Ninject.Extensions.Interception.Interceptors;
- using Xunit;
-
- public class DynamicProxy2ChannelFactoryProxyTest : DynamicProxy2BaseTests
- {
- #if !SILVERLIGHT
- [Fact]
- public void ProxiesCreatedWithChannelFactoryAreIntercepted()
- {
- using (StandardKernel kernel = CreateDefaultInterceptionKernel())
- {
- kernel.Bind<IFooService>().ToMethod(
- context =>
- ChannelFactory<IFooService>.CreateChannel(new NetTcpBinding(), new EndpointAddress("net.tcp://localhost/FooService")));
- kernel.Intercept((request) => true).With<FlagInterceptor>();
- var obj = kernel.Get<IFooService>();
- obj.Should().NotBeNull();
- typeof(IProxyTargetAccessor).IsAssignableFrom(obj.GetType()).Should().BeTrue();
- }
- }
- #endif
- }
- }