public void Test_MethodCLassMethod()
        {
            //arrange
              var gen = new TSInterface(typeof (IMethodClass), (t) => Settings.StartingTypeMap[t]);
            gen.Initialize();
            //act
            var res = gen.ToTSString();

            //assert
            Assert.IsTrue(res.Contains("MyMethod?(parm1:number/*Int32*/, parm2:string/*String*/, param3?:string/*Nullable`1*/):JQueryPromise<string>;"));
        }
Exemplo n.º 2
0
        public void Test_MethodCLassMethod()
        {
            //arrange
            var gen = new TSInterface(typeof(IMethodClass), (t) => Settings.StartingTypeMap[t]);

            gen.Initialize();
            //act
            var res = gen.ToTSString();

            //assert
            Assert.IsTrue(res.Contains("MyMethod?(parm1:number/*Int32*/, parm2:string/*String*/, param3?:string/*Nullable`1*/):JQueryPromise<string>;"));
        }
Exemplo n.º 3
0
        public void TestSimpleClass()
        {
            //arrange
            var c    = typeof(testClass1 <>);
            var prop = new TSInterface(c, (t) => "string");

            prop.Initialize();

            //act
            var res = prop.ToTSString();

            //assert
            Assert.IsTrue(!string.IsNullOrEmpty(res));
        }
Exemplo n.º 4
0
        public void TestDictClass()
        {
            //arrange
            var c    = typeof(Idictclass);
            var gen  = new TSGenerator();
            var prop = new TSInterface(c, gen.GenerateLookupTypeName);

            prop.Initialize();

            //act
            var res = prop.ToTSString();

            //assert
            Assert.IsTrue(!string.IsNullOrEmpty(res));
        }
Exemplo n.º 5
0
        public void Test_InterfaceGenerics()
        {
            //arrange
            var gen = new TSInterface(typeof(ITestGenerics <>), (t) =>
            {
                if (t.IsGenericParameter)
                {
                    return(t.Name);
                }
                return(Settings.StartingTypeMap[t]);
            });

            gen.Initialize();
            //act
            var res = gen.ToTSString();

            //assert
            Assert.IsTrue(res.Contains("interface ITestGenerics<T>"));
        }
Exemplo n.º 6
0
        public void Test_ClassGenerics()
        {
            //arrange
            var gen = new TSInterface(typeof(TestGenerics <>), (t) =>
            {
                if (t.Name.Contains("IEnumerable`1"))
                {
                    return("T[]");
                }
                return(Settings.StartingTypeMap[t]);
            });

            gen.Initialize();
            //act
            var res = gen.ToTSString();

            //assert
            Assert.IsTrue(res.Contains("interface ITestGenerics<T>"));
            Assert.IsTrue(res.Contains("Items: T[];"));
        }