Ejemplo n.º 1
0
        public void TestSafeCallReturn()
        {
            SomeDemoObject obj = new SomeDemoObject()
            {
                Integer = 9,
                String  = "vrk",
                Type    = "demo"
            };

            string str = obj.ToString();

            string strB = obj.SafeCall(sdo =>
            {
                return(sdo.ToString());
            });

            strB.Should().Be(str);
        }
Ejemplo n.º 2
0
        public void TestWithObject()
        {
            // the formatter expects the value to be string
            TrimSpacesFormatter formatter = new TrimSpacesFormatter();
            SomeDemoObject      obj       = new SomeDemoObject()
            {
                Integer = 100,
                String  = "Some text",
                Type    = "Demo"
            };

            Action act = () => formatter.Format(obj);

            act.ShouldThrowExactly <PtvArgumentException>($"Expected value is string! Value {obj.ToString()} of type SomeDemoObject is not valid.");
        }
Ejemplo n.º 3
0
        public void TestWithObject()
        {
            // the formatter expects the value to be string
            MaxLengthFormatter formatter = new MaxLengthFormatter();
            SomeDemoObject     obj       = new SomeDemoObject()
            {
                Integer = 100,
                String  = "Some text",
                Type    = "Demo"
            };

            Action act = () => formatter.Format(obj, "Demo", new MockResolveManager());

            act.ShouldThrowExactly <PtvArgumentException>($"Expected value is string! Value {obj.ToString()} of type Demo is not valid.");
        }