Exemple #1
0
        public void TestAskConfirmation()
        {
            var ioNull = new IONull();

            Assert.AreEqual(true, ioNull.AskConfirmation("Do you like me?", true));
            Assert.AreEqual(false, ioNull.AskConfirmation("Do you like me?", false));
        }
Exemple #2
0
        public void TestAsk()
        {
            var ioNull = new IONull();

            Assert.AreEqual("menghanyu", (string)ioNull.Ask("What's your name?", "menghanyu"));
            Assert.AreEqual(null, (string)ioNull.Ask("What's your name?"));
        }
Exemple #3
0
        public void TestAskChoiceMult()
        {
            var ioNull = new IONull();
            var answer = ioNull.AskChoiceMult("What's you name?", new[] { "miaomiao", "menghan", "tutu" }, new[] { "menghan", "miaomiao" });

            CollectionAssert.AreEqual(new[] { 1, 0 }, answer);

            answer = ioNull.AskChoiceMult("What's you name?", new[] { "miaomiao", "menghan", "tutu" }, new[] { 2, 0 });
            CollectionAssert.AreEqual(new[] { 2, 0 }, answer);
        }
Exemple #4
0
        public void TestAskChoice()
        {
            var ioNull = new IONull();
            var answer = ioNull.AskChoice("What's you name?", new[] { "miaomiao", "menghan" }, "unknow");

            Assert.AreEqual(-1, answer);

            answer = ioNull.AskChoice("What's you name?", new[] { "miaomiao", "menghan" }, "menghan");
            Assert.AreEqual(1, answer);

            answer = ioNull.AskChoice("What's you name?", new[] { "miaomiao", "menghan" }, 0);
            Assert.AreEqual(0, answer);
        }
Exemple #5
0
        public void TestWriteWithLoggerLevel()
        {
            var ioNull  = new IONull();
            var message = "not throw exception";

            ioNull.Debug(message);
            ioNull.Info(message);
            ioNull.Notice(message);
            ioNull.Warning(message);
            ioNull.Error(message);
            ioNull.Critical(message);
            ioNull.Alert(message);
            ioNull.Emergency(message);
        }
Exemple #6
0
        public void TestAskAndValidate()
        {
            var ioNull = new IONull();

            Assert.AreEqual(null, ioNull.AskAndValidate("Do you like me?", (value) => "foo"));
        }
Exemple #7
0
        public void TestIsVeryVerbose()
        {
            var ioNull = new IONull();

            Assert.IsFalse(ioNull.IsVeryVerbose);
        }
Exemple #8
0
        public void TestIsDebug()
        {
            var ioNull = new IONull();

            Assert.IsFalse(ioNull.IsDebug);
        }
Exemple #9
0
        public void TestIsDecorated()
        {
            var ioNull = new IONull();

            Assert.IsFalse(ioNull.IsDecorated);
        }
Exemple #10
0
        public void TestIsInteractive()
        {
            var ioNull = new IONull();

            Assert.IsFalse(ioNull.IsInteractive);
        }
Exemple #11
0
        public void TestOverwriteError()
        {
            var ioNull = new IONull();

            ioNull.OverwriteError("not throw exception");
        }
Exemple #12
0
        public void TestWrite()
        {
            var ioNull = new IONull();

            ioNull.Write("not throw exception");
        }