Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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);
            }
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
0
        public void ShouldSupportDatetimeOffsetAsStrings()
        {
            var context = new TypeContext(new Settings
            {
                UseNativeDates = false
            });

            var resolvedType = context.GetTypeScriptType(typeof(DateTimeOffset).FullName);
            Assert.IsInstanceOfType(resolvedType, typeof(StringType));
        }
Esempio n. 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));
        }
Esempio n. 7
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));
        }
Esempio n. 8
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));
        }