Beispiel #1
0
        private void UpdateCategoryView(Test test)
        {
            string s = "", testSource = "";
            string addedFlag = "";

            string[] sourceKeys = { ExtentFlag.GetPlaceHolder("categoryViewName"),
                                    ExtentFlag.GetPlaceHolder("categoryViewTestDetails") };
            string[] testKeys = { ExtentFlag.GetPlaceHolder("categoryViewTestRunTime"),
                                  ExtentFlag.GetPlaceHolder("categoryViewTestName"),
                                  ExtentFlag.GetPlaceHolder("categoryViewTestStatus") };
            string[] testValues = { test.StartedTime.ToString(),
                                    test.Name,
                                    test.Status.ToString().ToLower() };

            foreach (TestAttribute attr in test.CategoryList)
            {
                addedFlag = ExtentFlag.GetPlaceHolder("categoryViewTestDetails" + attr.GetName());

                if (!extentSource.Contains(addedFlag))
                {
                    string[] sourceValues = { attr.GetName(), addedFlag };

                    s         += SourceBuilder.Build(CategoryHtml.GetCategoryViewSource(), sourceKeys, sourceValues);
                    testSource = SourceBuilder.Build(CategoryHtml.GetCategoryViewTestSource(), testKeys, testValues);
                    s          = SourceBuilder.Build(s, new string[] { addedFlag }, new string[] { testSource + addedFlag });
                }
                else
                {
                    testSource = SourceBuilder.Build(CategoryHtml.GetCategoryViewTestSource(), testKeys, testValues);

                    lock (sourcelock)
                    {
                        extentSource = SourceBuilder.Build(extentSource, new string[] { addedFlag }, new string[] { testSource + addedFlag });
                    }
                }
            }

            lock (sourcelock)
            {
                extentSource = SourceBuilder.Build(extentSource,
                                                   new string[] { ExtentFlag.GetPlaceHolder("extentCategoryDetails") },
                                                   new string[] { s + ExtentFlag.GetPlaceHolder("extentCategoryDetails") });
            }
        }
        private void UpdateCategoryView(Test test)
        {
            string text = string.Empty;

            string[] flags = new string[]
            {
                UnifiedReportFlag.GetPlaceHolder("categoryViewName"),
                UnifiedReportFlag.GetPlaceHolder("categoryViewTestDetails")
            };
            string[] flags2 = new string[]
            {
                UnifiedReportFlag.GetPlaceHolder("categoryViewTestRunTime"),
                UnifiedReportFlag.GetPlaceHolder("categoryViewTestName"),
                UnifiedReportFlag.GetPlaceHolder("categoryViewTestStatus")
            };
            string[] values = new string[]
            {
                test.StartedTime.ToString(),
                     test.Name,
                     test.Status.ToString().ToLower()
            };
            foreach (TestAttribute current in test.CategoryList)
            {
                string placeHolder = UnifiedReportFlag.GetPlaceHolder("categoryViewTestDetails" + current.GetName());
                if (!this.unifiedReportSource.Contains(placeHolder))
                {
                    string[] values2 = new string[]
                    {
                        current.GetName(),
                             placeHolder
                    };
                    text += SourceBuilder.Build(CategoryHtml.GetCategoryViewSource(), flags, values2);
                    string str = SourceBuilder.Build(CategoryHtml.GetCategoryViewTestSource(), flags2, values);
                    text = SourceBuilder.Build(text, new string[]
                    {
                        placeHolder
                    }, new string[]
                    {
                        str + placeHolder
                    });
                }
                else
                {
                    string str = SourceBuilder.Build(CategoryHtml.GetCategoryViewTestSource(), flags2, values);
                    lock (this.sourcelock)
                    {
                        this.unifiedReportSource = SourceBuilder.Build(this.unifiedReportSource, new string[]
                        {
                            placeHolder
                        }, new string[]
                        {
                            str + placeHolder
                        });
                    }
                }
            }
            lock (this.sourcelock)
            {
                this.unifiedReportSource = SourceBuilder.Build(this.unifiedReportSource, new string[]
                {
                    UnifiedReportFlag.GetPlaceHolder("extentCategoryDetails")
                }, new string[]
                {
                    text + UnifiedReportFlag.GetPlaceHolder("extentCategoryDetails")
                });
            }
        }