コード例 #1
0
        public void Prompt_NameUpperCase()
        {
            var options = new PromptOptions(new List <PromptOption>()
            {
                new PromptOption("Yes", 'y'),
            });

            Assert.AreEqual("[y]es", options.ToString());
        }
コード例 #2
0
        public void Prompt_DefaultChoice()
        {
            var options = new PromptOptions(new List <PromptOption>()
            {
                new PromptOption("yes"),
                new PromptOption("no")
            }, 'n');

            Assert.AreEqual("[y]es | [N]o", options.ToString());
        }
コード例 #3
0
        public void Prompt_KeyNotPartOfName()
        {
            var options = new PromptOptions(new List <PromptOption>()
            {
                new PromptOption("ja", 'y'),
                new PromptOption("nein", 'n'),
            });

            Assert.AreEqual("ja [y] | [n]ein", options.ToString());
        }
コード例 #4
0
        public void Select_ReturnFunctionOutput()
        {
            var name    = "Output";
            var options = new PromptOptions(new List <PromptOption>()
            {
                new PromptOption("upper case", () => name.ToUpper())
            });

            Assert.AreEqual("[u]pper case", options.ToString());
            Assert.AreEqual("OUTPUT", options.Select('u'));
        }
コード例 #5
0
        public void Prompt_NoDefaultChoice()
        {
            var options = new PromptOptions(new List <PromptOption>()
            {
                new PromptOption("yes"),
                new PromptOption("no")
            });

            Assert.AreEqual("[y]es | [n]o", options.ToString());
            Assert.AreEqual(null, options.DefaultOption);
        }