Exemplo n.º 1
0
 public void CreateServiceHost_ServiceTypeIsInterfaceWithServiceContractAttribute_ReturnsServieHostWithProxyAsServiceType()
 {
     var lightInjectServiceHostFactory = new LightInjectServiceHostFactory();
     var serviceType = typeof(IServiceWithServiceContractAttribute);
     var serviceHost = lightInjectServiceHostFactory.CreateServiceHost(serviceType.AssemblyQualifiedName, new Uri[] { });
     var returnedServiceType = serviceHost.Description.ServiceType;
     Assert.IsTrue(typeof(IProxy).IsAssignableFrom(returnedServiceType));
 }
Exemplo n.º 2
0
 public void CreateServiceHost_ServiceTypeIsNotKnown_ThrowsArgumentException()
 {
     var lightInjectServiceHostFactory = new LightInjectServiceHostFactory();
     ExceptionAssert.Throws<ArgumentException>(() => lightInjectServiceHostFactory.CreateServiceHost("unknown", new Uri[] { }));
 }
Exemplo n.º 3
0
 public void CreateServiceHost_ServiceTypeIsInterfaceWithoutServiceContractAttribute_ThrowsNotSupportedException()
 {
     var lightInjectServiceHostFactory = new LightInjectServiceHostFactory();
     var serviceType = typeof(IServiceWithoutServiceContractAttribute);
     ExceptionAssert.Throws<NotSupportedException>(() => lightInjectServiceHostFactory.CreateServiceHost(serviceType.AssemblyQualifiedName, new Uri[] { }));
 }
Exemplo n.º 4
0
 public void CreateServiceHost_ServiceTypeIsConcrete_ThrowsNotSupportedException()
 {
     var lightInjectServiceHostFactory = new LightInjectServiceHostFactory();
     var serviceType = typeof(Service);
     ExceptionAssert.Throws<NotSupportedException>(() => lightInjectServiceHostFactory.CreateServiceHost(serviceType.AssemblyQualifiedName, new Uri[] { }));
 }