public void Test_FillArguments()
        {
            ClearAll();

            var testObject = new BundleObject
                {
                    TheBool1 = false,
                    TheBool2 = true,
                    TheGuid1 = Guid.NewGuid(),
                    TheGuid2 = new Guid(123, 10, 444, 1, 2, 3, 4, 5, 6, 7, 8),
                    TheInt1 = 123,
                    TheInt2 = 456,
                    TheString1 = "Hello World",
                    TheString2 = "Goo"
                };
            var bundle = new MvxBundle();
            bundle.Write(testObject);

            var method = GetType().GetMethod("TestFunction");
            var args = bundle.CreateArgumentList(method.GetParameters(), "ignored debug text");
            var output = method.Invoke(this, args.ToArray());

            var expected = new BundleObject
                {
                    TheBool1 = false,
                    TheBool2 = true,
                    TheGuid1 = Guid.Empty,
                    TheGuid2 = new Guid(123, 10, 444, 1, 2, 3, 4, 5, 6, 7, 8),
                    TheInt1 = 0,
                    TheInt2 = 456,
                    TheString1 = "Hello World",
                    TheString2 = null
                };
            Assert.AreEqual(expected, output);
        }
Example #2
0
        public void Test_FillArguments()
        {
            ClearAll();

            Ioc.RegisterSingleton <IMvxStringToTypeParser>(new MvxStringToTypeParser());

            var testObject = new BundleObject
            {
                TheBool1   = false,
                TheBool2   = true,
                TheGuid1   = Guid.NewGuid(),
                TheGuid2   = new Guid(123, 10, 444, 1, 2, 3, 4, 5, 6, 7, 8),
                TheInt1    = 123,
                TheInt2    = 456,
                TheString1 = "Hello World",
                TheString2 = "Goo"
            };
            var bundle = new MvxBundle();

            bundle.Write(testObject);

            var method = GetType().GetMethod("TestFunction");
            var args   = bundle.CreateArgumentList(method.GetParameters(), "ignored debug text");
            var output = method.Invoke(this, args.ToArray());

            var expected = new BundleObject
            {
                TheBool1   = false,
                TheBool2   = true,
                TheGuid1   = Guid.Empty,
                TheGuid2   = new Guid(123, 10, 444, 1, 2, 3, 4, 5, 6, 7, 8),
                TheInt1    = 0,
                TheInt2    = 456,
                TheString1 = "Hello World",
                TheString2 = null
            };

            Assert.AreEqual(expected, output);
        }