Пример #1
0
        public void TyrParse_StringValue_IsNotValid()
        {
            string str = "string";

            Assert.IsFalse(YesNo.TryParse(str, out YesNo val), "Valid");
            Assert.AreEqual(string.Empty, val.ToString(), "Value");
        }
Пример #2
0
        public void TyrParse_Questionmark_IsValid()
        {
            string str = "?";

            Assert.IsTrue(YesNo.TryParse(str, out YesNo val), "Valid");
            Assert.IsTrue(val.IsUnknown(), "Value");
        }
Пример #3
0
        public void TyrParse_StringEmpty_IsValid()
        {
            string str = string.Empty;

            Assert.IsTrue(YesNo.TryParse(str, out YesNo val), "Valid");
            Assert.AreEqual(string.Empty, val.ToString(), "Value");
        }
Пример #4
0
 public void TyrParse_StringValue_IsValid()
 {
     using (new CultureInfoScope("en"))
     {
         string str = "yes";
         Assert.IsTrue(YesNo.TryParse(str, out YesNo val), "Valid");
         Assert.AreEqual(str, val.ToString(), "Value");
     }
 }
Пример #5
0
        public void TryParse_InvalidInput_DefaultValue()
        {
            using (new CultureInfoScope("en-GB"))
            {
                var exp = default(YesNo);
                var act = YesNo.TryParse("InvalidInput");

                Assert.AreEqual(exp, act);
            }
        }
Пример #6
0
        public void TryParse_TestStructInput_AreEqual()
        {
            using (new CultureInfoScope("en-GB"))
            {
                var exp = TestStruct;
                var act = YesNo.TryParse(exp.ToString());

                Assert.AreEqual(exp, act);
            }
        }