public void InitializeTypeMapper_should_call_Map_with_initializers_found_in_assembly()
        {
            // Arrange
            var initializer = new IInterfaceConventionInitializer();
            var typeMapper = M<ITypeMapper>();

            typeMapper.Expect(tm => tm.Map(typeof (ITypeMapper), typeof (TypeMapper)));
            typeMapper.Expect(tm => tm.Map(typeof (IInitializerFilter), typeof (InitializerFilter)));
            typeMapper.Expect(tm => tm.Map(typeof(IInitializerLocator), typeof(InitializerLocator)));
            typeMapper.Expect(tm => tm.Map(typeof(IPropertySetterFactory), typeof(PropertySetterFactory)));
            //typeMapper.Expect(tm => tm.Map(typeof(), typeof()));

            typeMapper.Expect(tm => tm.Map(typeof (IPropertyHelper<>), typeof (PropertyHelper<>)));
            typeMapper.Expect(tm => tm.Map(typeof (ITestDataBuilder<,>), typeof (TestDataBuilder<,>)));
            //typeMapper.Expect(tm => tm.Map(typeof (<>), typeof (<>)));

            // Act
            initializer.InitializeTypeMapper(typeMapper);

            // Assert
            typeMapper.VerifyAllExpectations();
        }
Ejemplo n.º 2
0
        public void Should_get_proper_mapping_to_types_for_interfaces()
        {
            // Arrange
            var initializer = new IInterfaceConventionInitializer();
            var typeMapper = new TypeMapper();

            // Act
            initializer.InitializeTypeMapper(typeMapper);

            // Assert
            typeMapper.Resolve(typeof (ITypeMapper)).ShouldEqual(typeof (TypeMapper));
            typeMapper.Resolve(typeof (IInitializerFilter)).ShouldEqual(typeof (InitializerFilter));
            typeMapper.Resolve(typeof (IInitializerLocator)).ShouldEqual(typeof (InitializerLocator));
            typeMapper.Resolve(typeof (IPropertySetterFactory)).ShouldEqual(typeof (PropertySetterFactory));

            typeMapper.Resolve(typeof (IPropertyHelper<string>)).ShouldEqual(typeof (PropertyHelper<string>));
            typeMapper.Resolve(typeof (IPropertyHelper<Int64>)).ShouldEqual(typeof (PropertyHelper<Int64>));
            typeMapper.Resolve(typeof (IPropertyHelper<>)).ShouldEqual(typeof (PropertyHelper<>));
        }