示例#1
0
        public void CreateWcfProxy_TargetDoesNotImplementInterface()
        {
            var    generator        = new ServiceHostProxyGenerator();
            object target           = new NotAServiceImplementation();
            Type   interfaceToProxy = typeof(IServiceContract);

            Assert.Throws <ArgumentException>(() => generator.CreateWcfProxy(interfaceToProxy, target));
        }
示例#2
0
        public void CreateWcfProxy_NullTarget()
        {
            var    generator        = new ServiceHostProxyGenerator();
            object target           = null;
            Type   interfaceToProxy = typeof(IServiceContract);

            Assert.Throws <ArgumentNullException>(() => generator.CreateWcfProxy(interfaceToProxy, target));
        }
示例#3
0
        public void CreateWcfProxy_NullInterface()
        {
            var    generator        = new ServiceHostProxyGenerator();
            object target           = new ServiceImplementation();
            Type   interfaceToProxy = null;

            Assert.Throws <ArgumentNullException>(() => generator.CreateWcfProxy(interfaceToProxy, target));
        }
示例#4
0
        public void CreateWcfProxy_CustomProxyTypeCanBeHosted()
        {
            var    generator        = new ServiceHostProxyGenerator();
            object target           = new ServiceImplementation();
            Type   interfaceToProxy = typeof(IServiceContract);
            var    proxy            = generator.CreateWcfProxy(interfaceToProxy, target);

            // XUnit does not have "Assert.DoesNotThrow".
            new ServiceHost(proxy.GetType(), new Uri("http://localhost:22111/Foo.svc"));
        }
示例#5
0
        public void Ctor_ProxyBuilderIsServiceHostProxyBuilder()
        {
            var generator = new ServiceHostProxyGenerator();

            Assert.IsType <ServiceHostProxyBuilder>(generator.ProxyBuilder);
        }