Example #1
0
        public void TryParse()
        {
            var bc = new BooleanConverter();

            Assert.IsFalse(bc.TryParse(null, out bool result));
            Assert.IsFalse(result);

            Assert.IsTrue(bc.TryParse(string.Empty, out result));
            Assert.IsFalse(result);

            Assert.IsTrue(bc.TryParse("N", out result));
            Assert.IsFalse(result);

            Assert.IsTrue(bc.TryParse("False", out result));
            Assert.IsFalse(result);

            Assert.IsTrue(bc.TryParse("Y", out result));
            Assert.IsTrue(result);

            Assert.IsTrue(bc.TryParse("True", out result));
            Assert.IsTrue(result);

            Assert.IsFalse(bc.TryParse("Z", out result));
            Assert.IsFalse(result);
        }