Exemplo n.º 1
0
        public void AsImplementedInterfacesMultiple()
        {
            var types  = new[] { typeof(DeliveryVehicle) };
            var mapper = new ServiceTypeMapper(types);

            mapper.Should().NotBeNull();

            mapper.ImplementedInterfaces();
            mapper.TypeMaps.Should().NotBeEmpty();
            mapper.TypeMaps.Count.Should().Be(1);

            var typeMap1 = mapper.TypeMaps[0];

            typeMap1.ImplementationType.Should().Be(typeof(DeliveryVehicle));

            var serviceTypes = typeMap1.ServiceTypes.ToList();

            serviceTypes.Count.Should().Be(5);
            serviceTypes.Should().Contain(new[] { typeof(IVehicle), typeof(ICar), typeof(ITruck), typeof(IVan), typeof(IMinivan) });
        }
Exemplo n.º 2
0
        public void AsImplementedInterfaces()
        {
            var types  = new[] { typeof(Service1), typeof(Service2), typeof(Service3) };
            var mapper = new ServiceTypeMapper(types);

            mapper.Should().NotBeNull();

            mapper.ImplementedInterfaces();
            mapper.TypeMaps.Should().NotBeEmpty();
            mapper.TypeMaps.Count.Should().Be(3);

            var typeMap1 = mapper.TypeMaps[0];

            typeMap1.ImplementationType.Should().Be(typeof(Service1));

            var serviceTypes = typeMap1.ServiceTypes.ToList();

            serviceTypes.Count.Should().Be(1);

            var serviceType1 = serviceTypes[0];

            serviceType1.Should().Be(typeof(IService));
        }