Exemple #1
0
            public async Task FooTask()
            {
                IConfigurationRoot config = ConfigBuilder.Default
                                            .Alter("App:EnableInvitationCreateEndpoint", "true")
                                            .Build();

                TestServer testServer = TestServerBuilder
                                        .BuildServer <Startup>(config);

                HttpClient client = await testServer
                                    .LoginAndGetAuthorizedClientAsync();

                HttpResponseMessage response = await client
                                               .PutJsonAsync("/invitations", new
                {
                    Email = "invited@localhost",
                    // Target client, is mostly one with GUI
                    ClientId = "mvc.hybrid"
                });

                response.EnsureSuccessStatusCode();


                var schema = SchemaUtils.GenerateSchema <InvitationsPutResultModel>();

                response.AssertSchema(@"{
                      'type': 'object',
                      'additionalProperties' : false,
                      'properties': {
                        'id': {
                          'type': [
                            'string',
                            'null'
                          ]
                        },
                        'error': {},
                        'stackTrace': {
                          'type': [
                            'string',
                            'null'
                          ]
                        }
                      },
                      'required': [
                        'type',
                        'error',
                        'stackTrace'
                      ]
                    }");
            }