Ejemplo n.º 1
0
        public void TestInvalidIntSwitchValue()
        {
            var a = new TestSwitch {
                Prop1 = 22
            };
            var builder = new StringWriter();

            Write(builder, a.GetType(), a);
            Assert.AreEqual(string.Empty, builder.ToString());
        }
Ejemplo n.º 2
0
        public void TestValidIntSwitchValue()
        {
            var a = new TestSwitch();

            for (var i = 0; i < 6; i++)
            {
                a.Prop1 = -3 + i;
                var builder = new StringWriter();
                Write(builder, a.GetType(), a);
                if (i == 0 || i == 6)
                {
                    Assert.AreEqual(string.Empty, builder.ToString());
                }
                else
                {
                    Assert.AreEqual($" -a={a.Prop1}", builder.ToString());
                }
            }
        }