예제 #1
0
        public BaseStepsApi(ScenarioContext scenarioContext)
        {
            this.TheScenarioContext = scenarioContext ?? throw new ArgumentNullException("scenarioContext");
            var testContext = scenarioContext.ScenarioContainer.Resolve <TestContext>();

            CustomTestLogger = new CustomTestLogger(testContext);
        }
        public void WhenIRequestTheCurrentWeatherForTheCity()
        {
            var client  = new RestClient(TestConfig.BaseUrl);
            var request = new RestRequest($"weather");

            request.AddParameter("q", _city);
            request.AddParameter("appid", TestConfig.ApiId);
            var response = client.Execute(request);


            TheScenarioContext.Set(response);

            CustomTestLogger.Debug($"Request URI: {response.ResponseUri}");
            CustomTestLogger.AttachTextAsFile(response.Content, "RequestCurrentWeatherForCity", "json");
        }