Ejemplo n.º 1
0
 public void TestSetup()
 {
     client     = new Client();
     response   = client.GetAsync(Constants.apiPublicAddress);
     result     = response.Result.Content.ReadAsStringAsync().GetAwaiter().GetResult();
     data       = QuickType.Welcome.FromJson(result);
     testReport = extent.CreateTest(TestContext.CurrentContext.Test.Name);
 }
Ejemplo n.º 2
0
        public void API_CheckForAnalyticsData()
        {
            try
            {
                System.Threading.Tasks.Task <HttpResponseMessage> response = client.GetAsync(Constants.apiPublicAddress);
                string            result        = response.Result.Content.ReadAsStringAsync().GetAwaiter().GetResult();
                QuickType.Welcome data          = QuickType.Welcome.FromJson(result);
                string            analyticsName = string.Empty;

                foreach (var componentPresentation in data.ComponentPresentations)
                {
                    if (componentPresentation.Component?.ContentFields != null && componentPresentation.Component.ContentFields?.Items != null)
                    {
                        foreach (var item in componentPresentation.Component.ContentFields.Items)
                        {
                            try
                            {
                                var suportingFields = item.SupportingFields;

                                if (suportingFields?.SupportingFields?.StandardMetadata?.AnalyticsName != null)
                                {
                                    analyticsName = suportingFields.SupportingFields.StandardMetadata.AnalyticsName;
                                    Validation.ValidateAnalyticsNameExist(analyticsName);
                                }

                                testReport.Pass($"Component '{analyticsName}' have 'Analytics Name' in it!");
                            }
                            catch (AssertionException)
                            {
                                testReport.Fail($"Component '{analyticsName}' DO NOT have 'Analytics Name' in it!");
                                throw;
                            }
                        }
                    }
                }
            }
            catch (NotImplementedException ex)
            {
                testReport.Fail(ex.StackTrace);
                throw;
            }
        }
Ejemplo n.º 3
0
 public static string ToJson(this Welcome self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings);