Exemple #1
0
        public void Should_ALLTitlesContains_EnteredTitle(string name, string title, ParameterType type)
        {
            _searchResponse =
                RestHttpClient.Create()
                .Get <SearchResponse>(new Parameter(name, title, type));    //yukarıdaki bilgiler ile istek atılır
            Assert.That(_searchResponse.StatusCode, Is.EqualTo(HttpStatusCode.OK),
                        string.Format(Messages.HTTP_Status_Error_Message, name, title, type, _searchResponse.ResponseUri,
                                      _searchResponse
                                      .Content)); //donen response status kontrol edilir beklenen status dönmediyse hata alır
            var responseData =
                JsonConverter.ConvertJsonToObject <SearchResponse>(_searchResponse
                                                                   .Content); // response content te bulunan data yı deserialize edilir
            var titleControl =
                responseData.Search.Find(x =>
                                         !x.Title.Contains(
                                             title)); //tüm titlelar arasında içinde harry potter geçmeyen data var mı kontrol edilir

            Assert.Null(titleControl,
                        string.Format(Messages.Title_Control_Error_Message, name, title, type, _searchResponse.ResponseUri,
                                      _searchResponse.Content, title, JsonConverter.ConvertObjectToJson(titleControl))
                        ); //title içerisinde olmayan data varsa hata verir.
        }