private void Assert(object json, RoleMappingRuleBase rules)
 {
     SerializationTestHelper.Expect(new
     {
         enabled  = true,
         roles    = new[] { "admin" },
         rules    = json,
         metadata = new
         {
             x = "y",
             //TODO test for null here again, limitation of Expect()
             //z = (object) null
         }
     }).WhenSerializing(new PutRoleMappingRequest("x")
     {
         Enabled  = true,
         Roles    = new[] { "admin" },
         Rules    = rules,
         Metadata = new Dictionary <string, object>
         {
             { "x", "y" },
             //{"z", null}
         }
     });
 }
 [U] public void Fluent() =>
 SerializationTestHelper.Expect(Json).FromRequest(c => c
                                                  .Indices.Create("index", ci => ci
                                                                  .Settings(s => s
                                                                            .Analysis(a => a
                                                                                      .TokenFilters(t => t
                                                                                                    .UserDefined(FilterName, UserDefinedFilter)
                                                                                                    )
                                                                                      )
                                                                            )
                                                                  )
                                                  );
 [U] public void Initializer() =>
 SerializationTestHelper.Expect(Json).FromRequest(c => c
                                                  .Indices.Create(new CreateIndexRequest("index")
 {
     Settings = new IndexSettings
     {
         Analysis = new Nest.Analysis
         {
             TokenFilters = new Nest.TokenFilters
             {
                 { FilterName, UserDefinedFilter }
             }
         }
     }
 }
                                                                  )
                                                  );
 [U] public virtual async Task TestPutSettingsRequest() => await Usage.AssertOnAllResponses(r =>
 {
     var json = new { settings = new { analysis = AnalysisJson } };
     SerializationTestHelper.Expect(json).FromRequest(r);
 });