public Task AdditionalPropertiesInPropertiesWithAPTypeString() => Test(async(host, pipeline) =>
        {
            PetAPInPropertiesWithAPString parameter = new PetAPInPropertiesWithAPString(5, "westus")
            {
                Name = "Funny",
                AdditionalProperties = new Dictionary <string, float>()
                {
                    { "height", 5.61f },
                    { "weight", 599f },
                    { "footsize", 11.5f }
                },
            };

            parameter["color"] = "red";
            parameter["city"]  = "Seattle";
            parameter["food"]  = "tikka masala";

            var response = await new PetsClient(ClientDiagnostics, pipeline, host).CreateAPInPropertiesWithAPStringAsync(parameter);

            var value = response.Value;
            Assert.AreEqual(5, value.Id);
            Assert.AreEqual("Funny", value.Name);
            Assert.AreEqual("westus", value.OdataLocation);
            Assert.AreEqual(5.61f, value.AdditionalProperties["height"]);
            Assert.AreEqual(599f, value.AdditionalProperties["weight"]);
            Assert.AreEqual(11.5f, value.AdditionalProperties["footsize"]);

            Assert.AreEqual("red", value["color"]);
            Assert.AreEqual("Seattle", value["city"]);
            Assert.AreEqual("tikka masala", value["food"]);
        });
Esempio n. 2
0
 public virtual Response <PetAPInPropertiesWithAPString> CreateAPInPropertiesWithAPString(PetAPInPropertiesWithAPString createParameters, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPInPropertiesWithAPString");
     scope.Start();
     try
     {
         return(RestClient.CreateAPInPropertiesWithAPString(createParameters, cancellationToken));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
Esempio n. 3
0
 public virtual async Task <Response <PetAPInPropertiesWithAPString> > CreateAPInPropertiesWithAPStringAsync(PetAPInPropertiesWithAPString createParameters, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("PetsClient.CreateAPInPropertiesWithAPString");
     scope.Start();
     try
     {
         return(await RestClient.CreateAPInPropertiesWithAPStringAsync(createParameters, cancellationToken).ConfigureAwait(false));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }