示例#1
0
        public void TyrParse_StringValue_IsNotValid()
        {
            string str = "string";

            Assert.IsFalse(HouseNumber.TryParse(str, out HouseNumber val), "Valid");
            Assert.AreEqual(string.Empty, val.ToString(), "Value");
        }
示例#2
0
        public void TyrParse_StringValue_IsValid()
        {
            string str = "123";

            Assert.IsTrue(HouseNumber.TryParse(str, out HouseNumber val), "Valid");
            Assert.AreEqual(str, val.ToString(), "Value");
        }
示例#3
0
        public void TyrParse_Questionmark_IsValid()
        {
            string str = "?";

            Assert.IsTrue(HouseNumber.TryParse(str, out HouseNumber val), "Valid");
            Assert.IsTrue(val.IsUnknown(), "Value");
        }
示例#4
0
        public void TyrParse_Null_IsValid()
        {
            string str = null;

            Assert.IsTrue(HouseNumber.TryParse(str, out HouseNumber val), "Valid");
            Assert.AreEqual(string.Empty, val.ToString(), "Value");
        }
示例#5
0
        public void TyrParse_StringEmpty_IsValid()
        {
            HouseNumber val;

            string str = string.Empty;

            Assert.IsTrue(HouseNumber.TryParse(str, out val), "Valid");
            Assert.AreEqual(string.Empty, val.ToString(), "Value");
        }
示例#6
0
        public void TryParse_InvalidInput_DefaultValue()
        {
            using (new CultureInfoScope("en-GB"))
            {
                var exp = default(HouseNumber);
                var act = HouseNumber.TryParse("InvalidInput");

                Assert.AreEqual(exp, act);
            }
        }
示例#7
0
        public void TryParse_TestStructInput_AreEqual()
        {
            using (new CultureInfoScope("en-GB"))
            {
                var exp = TestStruct;
                var act = HouseNumber.TryParse(exp.ToString());

                Assert.AreEqual(exp, act);
            }
        }