public void CreateAngularTsProxy_HasAttribute_False() { //Arrange var method = TestClassType.GetMethod("OneParam"); //Act var hasAttribute = ProxyBuildHelper.HasAttribute(typeof(CreateJQueryTsProxyAttribute), method); //Assert Assert.IsFalse(hasAttribute); }
public void One_Complex_Param_And_Two_Simple_Params() { //Arrange var method = TestClassType.GetMethod("OneComplexParamAndTwoSimple"); //Act var paramString = ProxyBuildHelper.GetFunctionParameters(method); //Assert Assert.AreEqual(paramString, "person,datum,name"); }
public void CreateAngularJsProxy_HasAttribute_True() { //Arrange var method = TestClassType.GetMethod("NoParam"); //Act var hasAttribute = ProxyBuildHelper.HasAttribute(typeof(CreateAngularJsProxyAttribute), method); //Assert Assert.IsTrue(hasAttribute); }
public void One_Complex_Param() { //Arrange var method = TestClassType.GetMethod("OneComplexParam"); //Act var paramString = ProxyBuildHelper.GetFunctionParameters(method); //Assert Assert.AreEqual(paramString, "person"); }
public void Three_Simple_Params() { //Arrange var method = TestClassType.GetMethod("ThreeSimpleParams"); //Act var paramString = ProxyBuildHelper.GetFunctionParameters(method); //Assert Assert.AreEqual(paramString, "name,alter,aktiv"); }
public void No_Param() { //Arrange var method = TestClassType.GetMethod("NoParam"); //Act var paramString = ProxyBuildHelper.GetFunctionParameters(method); //Assert Assert.AreEqual(paramString, ""); }
public void BuildPost_IsComplexeType_True() { //Arrange var methodInfos = new ProxyMethodInfos(); //Die MethodenInfos laden - können wir nicht Mocken! methodInfos.MethodInfo = TestClassType.GetMethod("OneComplexParam"); methodInfos.ProxyMethodParameterInfos.Add(new ProxyMethodParameterInfo() { IsComplexeType = true, ParameterName = "person" }); //Mocken der passenden Infos MockBuildHelper.Setup(p => p.GetClearControllerName(It.IsAny <Type>())).Returns("Home"); MockBuildHelper.Setup(p => p.BuildUrlParameterId(It.IsAny <List <ProxyMethodParameterInfo> >())).Returns(String.Empty); MockBuildHelper.Setup(p => p.BuildUrlParameter(It.IsAny <List <ProxyMethodParameterInfo> >())).Returns(" + '?name='+encodeURIComponent(name)"); //Act var getParams = ProxyBuilderHttpCall.BuildHttpCall(methodInfos, ProxyBuilder.AngularTypeScript); //Assert Assert.AreEqual(getParams, "post('Home/OneComplexParam' + '?name='+encodeURIComponent(name),person)"); }
public void BuildGet_NoComplexType_WithId() { //Arrange var methodInfos = new ProxyMethodInfos(); //Die MethodenInfos laden - können wir nicht Mocken! methodInfos.MethodInfo = TestClassType.GetMethod("OneParam"); methodInfos.ProxyMethodParameterInfos.Add(new ProxyMethodParameterInfo() { IsComplexeType = false, ParameterName = "id" }); //Mocken der passenden Infos MockBuildHelper.Setup(p => p.GetClearControllerName(It.IsAny <Type>())).Returns("Home"); MockBuildHelper.Setup(p => p.BuildUrlParameterId(It.IsAny <List <ProxyMethodParameterInfo> >())).Returns(" + '/' + id "); MockBuildHelper.Setup(p => p.BuildUrlParameter(It.IsAny <List <ProxyMethodParameterInfo> >())).Returns(" + '?name='+encodeURIComponent(name)"); //Act var getParams = ProxyBuilderHttpCall.BuildHttpCall(methodInfos, ProxyBuilder.AngularJavaScript); //Assert Assert.AreEqual(getParams, "get('Home/OneParam' + '/' + id + '?name='+encodeURIComponent(name))"); }