public void TestParse2() { // "value", true, 2004-03-25 12:00, var1 string args = @"""value"", true, 2004-03-25 12:00, var1"; object[] result = WxeVariablesContainer.ParseActualParameters(s_parameters, args, CultureInfo.InvariantCulture); Assert.That(result.Length, Is.EqualTo(4)); Assert.That(result[0], Is.EqualTo("value")); Assert.That(result[1], Is.EqualTo(true)); Assert.That(result[2], Is.EqualTo(new DateTime(2004, 3, 25, 12, 0, 0))); Assert.That(result[3], Is.EqualTo(new WxeVariableReference("var1"))); }
/// <summary> /// Gets the permanent URL for the <see cref="WxeFunction"/> defined by the /// <see cref="Command.WxeFunctionCommandInfo"/>. /// </summary> /// <param name="additionalUrlParameters"> /// The <see cref="NameValueCollection"/> containing additional url parameters. /// Must not be <see langword="null"/>. /// </param> /// <exception cref="InvalidOperationException"> /// <para> /// Thrown if called while the <see cref="Type"/> is not set to <see cref="CommandType.WxeFunction"/>. /// </para><para> /// Thrown if neither the <see cref="Command.WxeFunctionCommandInfo.MappingID"/> nor the /// <see cref="Command.WxeFunctionCommandInfo.TypeName"/> are set. /// </para><para> /// Thrown if the <see cref="Command.WxeFunctionCommandInfo.MappingID"/> and /// <see cref="Command.WxeFunctionCommandInfo.TypeName"/> specify different functions. /// </para> /// </exception> public virtual string GetWxeFunctionPermanentUrl(NameValueCollection additionalUrlParameters) { ArgumentUtility.CheckNotNull("additionalUrlParameters", additionalUrlParameters); if (Type != CommandType.WxeFunction) { throw new InvalidOperationException("Call to ExecuteWxeFunction not allowed unless Type is set to CommandType.WxeFunction."); } Type functionType = WxeFunctionCommand.ResolveFunctionType(); WxeParameterDeclaration[] parameterDeclarations = WxeVariablesContainer.GetParameterDeclarations(functionType); object[] parameterValues = WxeVariablesContainer.ParseActualParameters( parameterDeclarations, WxeFunctionCommand.Parameters, CultureInfo.InvariantCulture); NameValueCollection queryString = WxeVariablesContainer.SerializeParametersForQueryString(parameterDeclarations, parameterValues); queryString.Set(WxeHandler.Parameters.WxeReturnToSelf, true.ToString()); NameValueCollectionUtility.Append(queryString, additionalUrlParameters); return(WxeContext.GetPermanentUrl(new HttpContextWrapper(HttpContext.Current), functionType, queryString)); }
public void TestParseEx2() { WxeVariablesContainer.ParseActualParameters(s_parameters, "a, \"xyz\"", CultureInfo.InvariantCulture); }