locked
How to set a parameter as optional on Combination RRS feed

  • Question

  • I have function that has 2 required parameters and 1 optional parameter, how could I set it within Combination.Pairwise? Thanks

    config SubmitFormParameters : All
    {
        action static void SubmitPageAdapter.SubmitForm(
            string firstName, string middleName, string lastName)
            where 
            {.
                Combination.In<string>(firstName, "", "a", "aaaaaa");
                Combination.In<string>(middleName, "", "b", "bbbbb");
                Combination.In<string>(lastName, "", "c", "cccc");
                Combination.Pairwise(firstName, middleName, lastName);
            .};
    }

    Thursday, January 14, 2010 1:47 AM

Answers

  • Do you mean you have two actions (one with two parameters and one with one parameters)? Actions have a fixed number of parameters, regardless of parameter combinations.

    Tuesday, January 19, 2010 10:54 PM
    Moderator

All replies

  • I am not sure what do you mean by "optional".
    Take middleName as the example:
    If you do not care the values of parameter "middleName", you can set the combination like:

    config SubmitFormParameters : All
    {
        action static void SubmitPageAdapter.SubmitForm(
            string firstName, string middleName, string lastName)
            where 
            {.
                Combination.In<string>(firstName, "", "a", "aaaaaa");
                Combination.In<string>(middleName, "", "b", "bbbbb");
                Combination.In<string>(lastName, "", "c", "cccc");
                Combination.Pairwise(firstName, lastName);
            .};
    }
    Then middleName might always takes "" as its value.

    If you want every possible value of parameter "middleName" to appear, you can set the combination like:
    config SubmitFormParameters : All
    {
        action static void SubmitPageAdapter.SubmitForm(
            string firstName, string middleName, string lastName)
            where 
            {.
                Combination.In<string>(firstName, "", "a", "aaaaaa");
                Combination.In<string>(middleName, "", "b", "bbbbb");
                Combination.In<string>(lastName, "", "c", "cccc");
                Combination.Pairwise(firstName, lastName);
    Combination.Interaction(middleName); .}; }
    which means middleName only interacts with itself, and appear as 1-wise. The other two parameters interact with each other, and appear as 2-wise, i.e. pairwise.
    Thursday, January 14, 2010 4:47 PM
    Moderator
  • There is ? notation where the behavior is option. I wonder if there is something similar to use with Combination.In and Pairwise, something to specify that this combination is optional.
    Tuesday, January 19, 2010 10:14 PM
  • What would a combination meaning optional mean? You still need a domain for the parameters involved. Can you provide an example of what you would like to write?
    Tuesday, January 19, 2010 10:20 PM
    Moderator
  • config SubmitFormParameters : All
    {
        action static void SubmitPageAdapter.SubmitForm(
            string firstName, string middleName, string lastName)
            where
            {.
                Combination.In<string>(firstName, "", "a", "aaaaaa");
                Combination.In<string>(middleName, "", "b", "bbbbb");
                Combination.In<string>(lastName, "", "c", "cccc");
                Combination.Pairwise(firstName, middleName, lastName);
            .};
    }

    I try to make middleName as optional, meaning when I call SubmitForm, it either SubmitForm with only 2 parameters (firstName, lastName) or SubmitForm with all 3 parameters (firstName, middleName, lastName). And they are all under the pairwise condition.
    Tuesday, January 19, 2010 10:35 PM
  • Do you mean you have two actions (one with two parameters and one with one parameters)? Actions have a fixed number of parameters, regardless of parameter combinations.

    Tuesday, January 19, 2010 10:54 PM
    Moderator