Exemple #1
0
        public async Task RoutesToTypeAndMethodUsingMvcComplexObjectBinding()
        {
            var diagnostic = new DiagnosticModel
            {
                A = "A", B = 1.1f, Recurse = new DiagnosticModel {
                    A = "R.A", B = 1.2f
                }
            };
            var query    = "?a=-1&diagnostic.A=A&diagnostic.B=1.1&diagnostic.Recurse.A=R.A&diagnostic.Recurse.B=1.2";
            var url      = "/ComponentAsServiceDiagnostics/BindComplexObject" + query;
            var expected = new ComponentAsServiceDiagnostics().BindComplexObject(-1, diagnostic);

            var stringResult = await(await client.GetAsync(url)).Content.ReadAsStringAsync();

            Console.WriteLine(stringResult);
            stringResult.ShouldBe(expected);
        }
Exemple #2
0
        public async Task RoutesToTypeAndMethodUsingMvcComplexObjectBindingConfoundedByIgnoringCase()
        {
            var misdiagnostic = new DiagnosticModel
            {
                A = "-1", B = 1.1f, Recurse = new DiagnosticModel {
                    A = "R.A", B = 1.2f
                }
            };

            var query = "?a=-1&A=A&B=1.1&Recurse.A=R.A&Recurse.B=1.2";
            var url   = "/ComponentAsServiceDiagnostics/BindComplexObject" + query;

            var expected = new ComponentAsServiceDiagnostics().BindComplexObject(-1, misdiagnostic);

            var stringResult = await(await client.GetAsync(url)).Content.ReadAsStringAsync();

            Console.WriteLine(stringResult);
            stringResult.ShouldBe(expected, "Expected MVC binding to bind A=-1 instead of A=A");
        }