コード例 #1
0
        public void VerifyCountriesAreRetrieved()
        {
            var jsonData = JsonConvert.SerializeObject(new RestAssured()
                                                       .Given()
                                                       .Name("Validate US, DE and GB countries are retrieved correctly")
                                                       .Host(ApiService)
                                                       .Uri("/country/get/all")
                                                       .When()
                                                       .Get()
                                                       .Then()
                                                       .TestStatus("Verify Responde Code is 200", code => code == 200)
                                                       .Assert("Verify Response Code is 200")
                                                       .Retrieve(x => x.RestResponse.result));

            var countries                = CountryHelper.GetCountriesFromJson(jsonData);
            var usaCountryExist          = CountryHelper.VerifyCountryAlphaTwoCodeExist(countries, "US");
            var germanyCountryExist      = CountryHelper.VerifyCountryAlphaTwoCodeExist(countries, "DE");
            var greatBritainCountryExist = CountryHelper.VerifyCountryAlphaTwoCodeExist(countries, "GB");

            Assert.IsTrue(usaCountryExist);
            Assert.IsTrue(germanyCountryExist);
            Assert.IsTrue(greatBritainCountryExist);
        }