public void ShouldAssignDefaultServiceWhenMultipleImplementationsOfTheSameInterfaceExist() { var loader = new ServiceLoader(); IEnumerable<IServiceInfo> list = loader.Load(hostAssembly); var serviceResolver = new DefaultServiceResolver(); IServiceInfo serviceInfo = serviceResolver.GetDefaultService(typeof(IVehicle), list); Assert.AreEqual("Vehicle", serviceInfo.ServiceName); Assert.AreEqual(typeof(IVehicle), serviceInfo.ServiceType); Assert.AreEqual(typeof(Vehicle), serviceInfo.ImplementingType); }
public void ShouldLoadTypeImplementationsHavingTheirTypeNameAsTheServiceName() { var loader = new ServiceLoader(); IEnumerable<IServiceInfo> list = loader.Load(hostAssembly); var expectedService = new ServiceInfo(typeof(IPerson), typeof(Person), "Person"); var serviceList = new List<IServiceInfo>(list); Assert.IsTrue(serviceList.Contains(expectedService)); }
public void ShouldNotHaveDefaultServicesWhenLoadingTypesFromAssembly() { var loader = new ServiceLoader(); IEnumerable<IServiceInfo> list = loader.Load(hostAssembly); var items = new List<IServiceInfo>(list); Assert.IsTrue(items.Count > 0); foreach (var service in list) { var serviceName = service.ServiceName; Assert.IsFalse(string.IsNullOrEmpty(serviceName)); } }
public void ShouldLoadImplementationMapIntoMemory() { var loader = new ServiceLoader(); IEnumerable<IServiceInfo> list = loader.Load(hostAssembly); Assert.IsNotNull(list); var items = new List<IServiceInfo>(list); Assert.IsTrue(items.Count > 0); }