예제 #1
0
        public void FindChannelType_WhenCalledWithSubclass_FindsChannelType()
        {
            Type t = WcfChannelProxyTypeBuilder.FindChannelType(typeof(StubProxyChannel));

            Assert.IsNotNull(t);
            Assert.AreEqual(t, typeof(IService));
        }
예제 #2
0
        public void BuildProxyType_WhenCalled_ImplementsInterfaceAndSubclassesProxyChannel()
        {
            WcfChannelProxyTypeBuilder builder = new WcfChannelProxyTypeBuilder(typeof(ProxyChannel <IService>));
            Type t = builder.BuildProxyType();

            Assert.IsNotNull(t);
            Assert.IsTrue(t.IsSubclassOf(typeof(ProxyChannel <IService>)));
            Assert.IsNotNull(t.GetInterface("IService", true));
        }
예제 #3
0
        public void Proxy_WhenCallingMethodThatReturnsNull_DoesNotThrowException()
        {
            WcfChannelProxyTypeBuilder builder = new WcfChannelProxyTypeBuilder(typeof(ProxyChannel <IService>));

            Type            t = builder.BuildProxyType();
            ConstructorInfo constructorInfo = t.GetConstructors()[0];

            ProxyChannel <IService> channel = (ProxyChannel <IService>)constructorInfo.Invoke(null);

            channel.ChannelManager = new StubChannelManager();
            ((IService)channel).ReturnComplexObject();
        }
예제 #4
0
 public void IsSubclassOfRawGeneric_WhenCalledWithClosedGenericSubclass_FindsGenericType()
 {
     Assert.IsTrue(WcfChannelProxyTypeBuilder.IsSubclassOfRawGeneric(typeof(ProxyChannel <>), typeof(StubProxyChannel)));
     Assert.IsFalse(WcfChannelProxyTypeBuilder.IsSubclassOfRawGeneric(typeof(ProxyChannel <>), typeof(TimeZone)));
 }
예제 #5
0
 public void Constructor_WhenCalledWithAnIncorrectType_ThrowsException()
 {
     WcfChannelProxyTypeBuilder builder = new WcfChannelProxyTypeBuilder(typeof(TimeZone));
 }