public void FindChannelType_WhenCalledWithSubclass_FindsChannelType() { Type t = WcfChannelProxyTypeBuilder.FindChannelType(typeof(StubProxyChannel)); Assert.IsNotNull(t); Assert.AreEqual(t, typeof(IService)); }
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)); }
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(); }
public void IsSubclassOfRawGeneric_WhenCalledWithClosedGenericSubclass_FindsGenericType() { Assert.IsTrue(WcfChannelProxyTypeBuilder.IsSubclassOfRawGeneric(typeof(ProxyChannel <>), typeof(StubProxyChannel))); Assert.IsFalse(WcfChannelProxyTypeBuilder.IsSubclassOfRawGeneric(typeof(ProxyChannel <>), typeof(TimeZone))); }
public void Constructor_WhenCalledWithAnIncorrectType_ThrowsException() { WcfChannelProxyTypeBuilder builder = new WcfChannelProxyTypeBuilder(typeof(TimeZone)); }