Ejemplo n.º 1
0
        public void TryConvertType_IntValue_ReturnsTrue()
        {
            IManosContext ctx = new ManosContextStub ();

            object data = null;
            bool converted = ParameterizedActionTarget.TryConvertType (ctx, typeof (int), "42", out data);
            Assert.IsTrue (converted);
        }
        public void TryConvertType_BadValue_ReturnsFalse()
        {
            IManosContext ctx = new ManosContextStub ();

            object data = null;
            bool converted = ParameterizedActionTarget.TryConvertType (ctx, typeof (int), new UnsafeString ("foobar"), out data);
            Assert.IsFalse (converted);
        }
Ejemplo n.º 3
0
        public void TryConvertType_IntValue_SetsDataNull()
        {
            IManosContext ctx = new ManosContextStub ();

            object data = null;

            ParameterizedActionTarget.TryConvertType (ctx, typeof (int), "foobar", out data);
            Assert.IsNull (data);
        }
Ejemplo n.º 4
0
        public void TryConvertType_IntValue_SetsData()
        {
            IManosContext ctx = new ManosContextStub ();

            object data = null;

            ParameterizedActionTarget.TryConvertType (ctx, typeof (int), "42", out data);
            Assert.AreEqual (42, data);
        }
Ejemplo n.º 5
0
        public void TryConvertType_StringValue_SetsData()
        {
            IManosContext ctx = new ManosContextStub ();

            object data = null;

            ParameterizedActionTarget.TryConvertType (ctx, typeof (string), "foobar", out data);
            Assert.AreEqual ("foobar", data);
        }
Ejemplo n.º 6
0
        public void TryConvertType_IntValue_ReturnsTrue()
        {
            IManosContext ctx = new ManosContextStub();

            object data = null;
            bool converted = ParameterizedActionTarget.TryConvertUnsafeString(ctx, typeof (int),
                                                                              GetMethodWithIntArg().GetParameters()[0],
                                                                              new UnsafeString("42"), out data);
            Assert.IsTrue(converted);
        }
Ejemplo n.º 7
0
        public void TryConvertType_StringValue_SetsData()
        {
            IManosContext ctx = new ManosContextStub();

            object data = null;

            ParameterizedActionTarget.TryConvertUnsafeString(ctx, typeof (string),
                                                             GetMethodWithStringArg().GetParameters()[0],
                                                             new UnsafeString("foobar"), out data);
            Assert.AreEqual("foobar", data);
        }
Ejemplo n.º 8
0
        public void TryConvertType_IntValue_SetsDataNull()
        {
            IManosContext ctx = new ManosContextStub();

            object data = null;

            ParameterizedActionTarget.TryConvertUnsafeString(ctx, typeof (int), GetMethodWithIntArg().GetParameters()[0],
                                                             new UnsafeString("foobar"), out data);
            Assert.IsNull(data);
        }