public void GetTypes_WithTypeDiscoveryService_NotIncludeGac() { Expect.Call(_serviceProvider.GetService(typeof(ITypeDiscoveryService))).Return(_typeDiscoveryService); Expect.Call(_typeDiscoveryService.GetTypes(typeof(object), true)) .Return( new object[] { typeof(ClassWithAllDataTypes), typeof(SimpleValueType), typeof(SimpleReferenceType), typeof(ManualBusinessObject), typeof(ClassDerivedFromBindableObjectBase), typeof(ClassDerivedFromBindableObjectWithIdentityBase), }); _mockRepository.ReplayAll(); var finder = new BindableObjectTypeFinder(_serviceProvider); List <Type> types = finder.GetTypes(false); Assert.That(types, Is.EquivalentTo(new[] { typeof(ClassWithAllDataTypes), typeof(ClassDerivedFromBindableObjectBase), typeof(ClassDerivedFromBindableObjectWithIdentityBase), })); _mockRepository.VerifyAll(); }
public void GetMixinConfiguration_IncludeGac() { Expect.Call(_serviceProvider.GetService(typeof(ITypeDiscoveryService))).Return(_typeDiscoveryService); Expect.Call(_typeDiscoveryService.GetTypes(typeof(object), false)) .Return( new object[] { typeof(DerivedBusinessObjectClassWithoutAttribute), typeof(SimpleBusinessObjectClass), typeof(ClassWithIdentity), typeof(ManualBusinessObject), }); _mockRepository.ReplayAll(); var finder = new BindableObjectTypeFinder(_serviceProvider); MixinConfiguration configuration = finder.GetMixinConfiguration(true); Assert.That(configuration.ClassContexts.Count, Is.EqualTo(3)); Assert.That(configuration.ClassContexts.ContainsExact(typeof(BaseBusinessObjectClass))); Assert.That(configuration.ClassContexts.ContainsExact(typeof(DerivedBusinessObjectClassWithoutAttribute)), Is.False); Assert.That(configuration.ClassContexts.ContainsExact(typeof(SimpleBusinessObjectClass))); Assert.That(configuration.ClassContexts.ContainsExact(typeof(ClassWithIdentity))); Assert.That(configuration.GetContext(typeof(BaseBusinessObjectClass)).Mixins.ContainsKey(typeof(BindableObjectMixin))); Assert.That(configuration.GetContext(typeof(ClassWithIdentity)).Mixins.ContainsKey(typeof(BindableObjectWithIdentityMixin))); _mockRepository.VerifyAll(); }
public void GetMixinConfiguration_NotIncludeGac() { Expect.Call(_serviceProvider.GetService(typeof(ITypeDiscoveryService))).Return(_typeDiscoveryService); Expect.Call(_typeDiscoveryService.GetTypes(typeof(object), true)).Return(new object[0]); _mockRepository.ReplayAll(); var finder = new BindableObjectTypeFinder(_serviceProvider); finder.GetMixinConfiguration(false); _mockRepository.VerifyAll(); }
public void GetTypes_WithoutTypeDiscoveryService() { Expect.Call(_serviceProvider.GetService(typeof(ITypeDiscoveryService))).Return(null); _mockRepository.ReplayAll(); var finder = new BindableObjectTypeFinder(_serviceProvider); List <Type> types = finder.GetTypes(false); Assert.That(types, Is.Empty); _mockRepository.VerifyAll(); }
public void GetTypes_WithTypeDiscoveryService_GetsTypeInheritingMixinFromBase() { Expect.Call(_serviceProvider.GetService(typeof(ITypeDiscoveryService))).Return(_typeDiscoveryService); Expect.Call(_typeDiscoveryService.GetTypes(typeof(object), true)) .Return( new object[] { typeof(DerivedBusinessObjectClassWithoutAttribute) }); _mockRepository.ReplayAll(); var finder = new BindableObjectTypeFinder(_serviceProvider); List <Type> types = finder.GetTypes(false); Assert.That(types, Is.EquivalentTo(new[] { typeof(DerivedBusinessObjectClassWithoutAttribute) })); _mockRepository.VerifyAll(); }