public void TyrParse_StringValue_IsNotValid() { string str = "string"; Assert.IsFalse(YesNo.TryParse(str, out YesNo val), "Valid"); Assert.AreEqual(string.Empty, val.ToString(), "Value"); }
public void TyrParse_Questionmark_IsValid() { string str = "?"; Assert.IsTrue(YesNo.TryParse(str, out YesNo val), "Valid"); Assert.IsTrue(val.IsUnknown(), "Value"); }
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"); }
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"); } }
public void TryParse_InvalidInput_DefaultValue() { using (new CultureInfoScope("en-GB")) { var exp = default(YesNo); var act = YesNo.TryParse("InvalidInput"); Assert.AreEqual(exp, act); } }
public void TryParse_TestStructInput_AreEqual() { using (new CultureInfoScope("en-GB")) { var exp = TestStruct; var act = YesNo.TryParse(exp.ToString()); Assert.AreEqual(exp, act); } }