Пример #1
0
        public void NotSupportedCases(Type nativeType)
        {
            // arrange
            var factory = new NamedTypeInfoFactory();

            // act
            bool success = factory.TryCreate(nativeType, out TypeInfo typeInfo);

            // assert
            Assert.False(success);
        }
Пример #2
0
        public void Case1()
        {
            // arrange
            var  factory    = new NamedTypeInfoFactory();
            Type nativeType = typeof(StringType);

            // act
            bool  success = factory.TryCreate(nativeType, out TypeInfo typeInfo);
            IType type    = typeInfo.TypeFactory(new StringType());

            // assert
            Assert.True(success);
            Assert.IsType <StringType>(type);
        }
Пример #3
0
        public void Case2_2()
        {
            // arrange
            var  factory    = new NamedTypeInfoFactory();
            Type nativeType = typeof(ListType <StringType>);

            // act
            bool  success = factory.TryCreate(nativeType, out TypeInfo typeInfo);
            IType type    = typeInfo.TypeFactory(new StringType());

            // assert
            Assert.True(success);
            Assert.IsType <ListType>(type);
            type = ((ListType)type).ElementType as IOutputType;
            Assert.IsType <StringType>(type);
        }