Questions - Galad/tranquire GitHub Wiki

Implementing questions

Select extension method

The Select extension method allows the create a new question that modifies the result of the source question.

var question = new PageUrl().Select(url => new Uri(url));

SelectMany extension method

The SelectMany extension method allows to create an action or a question that depends on the result of another question.

var action = TextContent.Of(label).SelectMany(text => Enter.TheValue(text).Into(otherLabel));

Questions.FromResult

Questions.FromResult can create a question that returns always the same result.

var action = Questions.FromResult("test");

Questions.Create

Actions.Create can be used to create a question without having to implement an IQuestion interface.

var action = Questions.Create("Get items", actor => 
{
    return actor.AskFor(TextContent.Of(ToDoItemTarget).Value));
});