コード例 #1
0
        public void ShouldSupportIEnumerableTypes()
        {
            var context = new TypeContext(new Settings());

            var resolvedType = context.GetTypeScriptType(typeof(IEnumerable <String>).FullName);

            Assert.IsInstanceOfType(resolvedType, typeof(ArrayType));

            resolvedType = context.GetTypeScriptType("System.Collections.Generic.IEnumerable<System.String>");
            Assert.IsInstanceOfType(resolvedType, typeof(ArrayType));
        }
コード例 #2
0
        public void ShouldSupportDicionaryTypes()
        {
            var context = new TypeContext(new Settings());

            var resolvedType = context.GetTypeScriptType(typeof(Dictionary <String, float>).FullName);

            Assert.IsInstanceOfType(resolvedType, typeof(DictionaryType));

            resolvedType = context.GetTypeScriptType("System.Collections.Generic.Dictionary<System.String, System.Float>");
            Assert.IsInstanceOfType(resolvedType, typeof(DictionaryType));
        }
コード例 #3
0
        public void ShouldSupportNumberTypes()
        {
            var inputTypes = new [] {
                typeof(byte),
                typeof(sbyte),
                typeof(short),
                typeof(ushort),
                typeof(int),
                typeof(uint),
                typeof(long),
                typeof(ulong),
                typeof(float),
                typeof(decimal),
                typeof(double)
            };

            var context      = new TypeContext(new Settings());
            var expectedType = typeof(NumberType);

            foreach (var type in inputTypes)
            {
                var resolvedType = context.GetTypeScriptType(type.FullName);
                Assert.IsInstanceOfType(resolvedType, expectedType);
            }
        }
コード例 #4
0
ファイル: TypeContextTests.cs プロジェクト: luisvsilva/t4ts
        public void ShouldSupportNumberTypes()
        {
            var inputTypes = new [] {
                typeof(byte),
                typeof(sbyte),
                typeof(short),
                typeof(ushort),
                typeof(int),
                typeof(uint),
                typeof(long),
                typeof(ulong),
                typeof(float),
                typeof(decimal),
                typeof(double)
            };

            var context = new TypeContext(new Settings());
            var expectedType = typeof(NumberType);

            foreach (var type in inputTypes)
            {
                var resolvedType = context.GetTypeScriptType(type.FullName);
                Assert.IsInstanceOfType(resolvedType, expectedType);
            }
        }
コード例 #5
0
ファイル: TypeContextTests.cs プロジェクト: luisvsilva/t4ts
        public void ShouldSupportDatetimeOffsetAsStrings()
        {
            var context = new TypeContext(new Settings
            {
                UseNativeDates = false
            });

            var resolvedType = context.GetTypeScriptType(typeof(DateTimeOffset).FullName);
            Assert.IsInstanceOfType(resolvedType, typeof(StringType));
        }
コード例 #6
0
        public void ShouldSupportDatetimesAsNativeDates()
        {
            var context = new TypeContext(new Settings
            {
                UseNativeDates = true
            });

            var resolvedType = context.GetTypeScriptType(typeof(DateTime).FullName);

            Assert.IsInstanceOfType(resolvedType, typeof(DateTimeType));
        }
コード例 #7
0
ファイル: TypeContextTests.cs プロジェクト: luisvsilva/t4ts
        public void ShouldSupportDicionaryTypes()
        {
            var context = new TypeContext(new Settings());

            var resolvedType = context.GetTypeScriptType(typeof(Dictionary<String, float>).FullName);
            Assert.IsInstanceOfType(resolvedType, typeof(DictionaryType));

            resolvedType = context.GetTypeScriptType("System.Collections.Generic.Dictionary<System.String, System.Float>");
            Assert.IsInstanceOfType(resolvedType, typeof(DictionaryType));
        }
コード例 #8
0
ファイル: TypeContextTests.cs プロジェクト: luisvsilva/t4ts
        public void ShouldSupportIEnumerableTypes()
        {
            var context = new TypeContext(new Settings());

            var resolvedType = context.GetTypeScriptType(typeof(IEnumerable<String>).FullName);
            Assert.IsInstanceOfType(resolvedType, typeof(ArrayType));

            resolvedType = context.GetTypeScriptType("System.Collections.Generic.IEnumerable<System.String>");
            Assert.IsInstanceOfType(resolvedType, typeof(ArrayType));
        }