示例#1
0
 public void Setup()
 {
     //Arrange
     _proxyBuilderDataTypeHelper = new ProxyBuilderDataTypeHelper(new ProxySettings()
     {
         TypeLiteInterfacePrefix = "I"
     });
 }
        public void HasReturnType_False_Void()
        {
            //Arrange
            var proxyBuilderDataTypeHelper = new ProxyBuilderDataTypeHelper(new ProxySettings());

            //Act
            var result = proxyBuilderDataTypeHelper.HasReturnType(typeof(void));

            //Assert
            Assert.IsFalse(result);
        }
        public void HasReturnType_True()
        {
            //Arrange
            var proxyBuilderDataTypeHelper = new ProxyBuilderDataTypeHelper(new ProxySettings());

            //Act
            var result = proxyBuilderDataTypeHelper.HasReturnType(typeof(string));

            //Assert
            Assert.IsTrue(result);
        }
        public void HasReturnType_True()
        {
            //Arrange
            var proxyBuilderDataTypeHelper = new ProxyBuilderDataTypeHelper(new ProxySettings());

            //Act
            var result = proxyBuilderDataTypeHelper.HasReturnType(typeof (string));

            //Assert
            Assert.IsTrue(result);
        }
        public void HasReturnType_False_Void()
        {
            //Arrange
            var proxyBuilderDataTypeHelper = new ProxyBuilderDataTypeHelper(new ProxySettings());

            //Act
            var result = proxyBuilderDataTypeHelper.HasReturnType(typeof(void));

            //Assert
            Assert.IsFalse(result);
        }
        public void AddInterfacePrefixToFullName_NoEnum_NoPrefix_NoNs()
        {
            //Arrange
            var proxyBuilderDataType = new ProxyBuilderDataTypeHelper(new ProxySettings() { TypeLiteInterfacePrefix = "" });

            //Act
            var result = proxyBuilderDataType.AddInterfacePrefixToFullName("Person", false);

            //Assert
            Assert.AreEqual("Person", result);
        }
        public void AddInterfacePrefixToFullName_Enum_NoPrefix()
        {
            //Arrange
            var proxyBuilderDataType = new ProxyBuilderDataTypeHelper(new ProxySettings() { TypeLiteInterfacePrefix = "" });

            //Act
            var result = proxyBuilderDataType.AddInterfacePrefixToFullName("Test.Common.TestEnum", true);

            //Assert
            Assert.AreEqual("Test.Common.TestEnum", result);
        }
        public void GetTsType_ComplexType_Person_No_I()
        {
            //Arrange
            var proxyBuilder = new ProxyBuilderDataTypeHelper(new ProxySettings() { TypeLiteInterfacePrefix = string.Empty});

            //Act
            var result = proxyBuilder.GetTsType(typeof(Person));

            //Assert
            Assert.AreEqual("UnitTests.TestHelper.TestClasses.Person", result);
        }
        public void GetFunctionParametersWithType_OneParam()
        {
            //Arrange
            //Da es nur eine Klasse gibt Single verwenden und die Methode mit dem übergebenen Namen suchen.
            var methods = TestClassTypes.Single().GetMethods().FirstOrDefault(p => p.Name == "OneParam");

            var proxyBuilderDataType = new ProxyBuilderDataTypeHelper(new ProxySettings() { TypeLiteInterfacePrefix = "I" });

            //Act
            var result = proxyBuilderDataType.GetFunctionParametersWithType(methods);

            //Assert
            Assert.AreEqual("name: string", result);
        }
示例#10
0
        public void GetTsType_ComplexType_Person_No_I()
        {
            //Arrange
            var proxyBuilder = new ProxyBuilderDataTypeHelper(new ProxySettings()
            {
                TypeLiteInterfacePrefix = string.Empty
            });

            //Act
            var result = proxyBuilder.GetTsType(typeof(Person));

            //Assert
            Assert.AreEqual("UnitTests.TestHelper.TestClasses.Person", result);
        }
示例#11
0
        public void AddInterfacePrefixToFullName_Enum_I_Prefix()
        {
            //Arrange
            var proxyBuilderDataType = new ProxyBuilderDataTypeHelper(new ProxySettings()
            {
                TypeLiteInterfacePrefix = "I"
            });

            //Act
            var result = proxyBuilderDataType.AddInterfacePrefixToFullName("Test.Common.TestEnum", true);

            //Assert
            Assert.AreEqual("Test.Common.TestEnum", result);
        }
示例#12
0
        public void AddInterfacePrefixToFullName_NoEnum_NoPrefix_NoNs()
        {
            //Arrange
            var proxyBuilderDataType = new ProxyBuilderDataTypeHelper(new ProxySettings()
            {
                TypeLiteInterfacePrefix = ""
            });

            //Act
            var result = proxyBuilderDataType.AddInterfacePrefixToFullName("Person", false);

            //Assert
            Assert.AreEqual("Person", result);
        }
示例#13
0
        public void GetFunctionParametersWithType_ThreeSimpleParam()
        {
            //Arrange
            //Da es nur eine Klasse gibt Single verwenden und die Methode mit dem übergebenen Namen suchen.
            var methods = TestClassTypes.Single().GetMethods().FirstOrDefault(p => p.Name == "ThreeSimpleParams");

            var proxyBuilderDataType = new ProxyBuilderDataTypeHelper(new ProxySettings()
            {
                TypeLiteInterfacePrefix = "I"
            });

            //Act
            var result = proxyBuilderDataType.GetFunctionParametersWithType(methods);

            //Assert
            Assert.AreEqual("name: string,alter: number,aktiv: boolean", result);
        }
示例#14
0
        public void GetFunctionParametersWithType_OneComplexParamAndTwoSimple()
        {
            //Arrange
            //Da es nur eine Klasse gibt Single verwenden und die Methode mit dem übergebenen Namen suchen.
            var methods = TestClassTypes.Single().GetMethods().FirstOrDefault(p => p.Name == "OneComplexParamAndTwoSimple");

            var proxyBuilderDataType = new ProxyBuilderDataTypeHelper(new ProxySettings()
            {
                TypeLiteInterfacePrefix = "I"
            });

            //Act
            var result = proxyBuilderDataType.GetFunctionParametersWithType(methods);

            //Assert
            Assert.AreEqual("person: UnitTests.TestHelper.TestClasses.IPerson,datum: any,name: string", result);
        }
 public void Setup()
 {
     //Arrange
     _proxyBuilderDataTypeHelper = new ProxyBuilderDataTypeHelper(new ProxySettings() { TypeLiteInterfacePrefix = "I"});
 }