Container to keep track of test runs
Inheritance: Java.Lang.Object
        private View InflateItemView(TestRunInfo itemContent)
        {
            LinearLayout layout = new LinearLayout(_context);

            layout.Orientation = Orientation.Horizontal;

            View     indicatorView   = new View(_context);
            TextView descriptionView = new TextView(_context);

            descriptionView.Ellipsize = Android.Text.TextUtils.TruncateAt.Start;
            descriptionView.Gravity   = GravityFlags.CenterVertical;

            if (itemContent.IsTestSuite)
            {
                layout.SetBackgroundColor(Color.Argb(255, 50, 50, 50));

                indicatorView.LayoutParameters = new LinearLayout.LayoutParams(18, 18)
                {
                    LeftMargin   = 14,
                    RightMargin  = 14,
                    TopMargin    = 14,
                    BottomMargin = 14,
                    Gravity      = GravityFlags.CenterVertical
                };

                descriptionView.LayoutParameters = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent)
                {
                    BottomMargin = 14,
                    TopMargin    = 14,
                    RightMargin  = 14,
                    Height       = 48,
                    Gravity      = GravityFlags.CenterVertical
                };
            }
            else
            {
                indicatorView.LayoutParameters = new LinearLayout.LayoutParams(18, LinearLayout.LayoutParams.FillParent)
                {
                    RightMargin = 20
                };

                descriptionView.LayoutParameters = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent)
                {
                    BottomMargin = 20,
                    TopMargin    = 20,
                    RightMargin  = 20,
                    Gravity      = GravityFlags.CenterVertical
                };
            }

            layout.AddView(indicatorView);
            layout.AddView(descriptionView);

            layout.Tag = new TestResultViewHolder(indicatorView, descriptionView);

            return(layout);
        }
        /// <summary>
        /// Handles the creation of the activity
        /// </summary>
        /// <param name="savedInstanceState"></param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var testCaseName = Intent.GetStringExtra("TestCaseName");
            _testRunInfo = TestRunContext.Current.TestResults.First(item => item.TestCaseName == testCaseName);

            _detailsView = new TestRunDetailsView(this, _testRunInfo) { Description = DefaultDescription };
            SetContentView(_detailsView);
        }
        public TestResultsGroupView(Context context, TestRunInfo testRunInfo) : base(context)
        {
            var indicatorView = new View(context)
            {
                LayoutParameters = new LayoutParams(18, 18)
                {
                    LeftMargin = 60,
                    RightMargin = 14,
                    TopMargin = 14,
                    BottomMargin = 14,
                    Gravity = GravityFlags.CenterVertical
                }
            };
            indicatorView.SetBackgroundColor(
                testRunInfo.IsIgnored ? Color.Yellow
                : testRunInfo.Running ? Color.Gray
                : testRunInfo.Passed ? Color.Green
                : Color.Red);
            AddView(indicatorView);

            var container = new LinearLayout(context)
            {
                Orientation = Orientation.Vertical,
                LayoutParameters =
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
            };
            AddView(container);

            var text1 = new TextView(context)
            {
                Text = testRunInfo.Description,
                Ellipsize = TextUtils.TruncateAt.Marquee,
                LayoutParameters =
                    new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };
            text1.SetTextSize(ComplexUnitType.Sp, 22);
            text1.SetSingleLine(true);
            text1.SetPadding(2, 2, 2, 2);
            container.AddView(text1);

            var text2 = new TextView(context)
            {
                Text = testRunInfo.TestCaseName,
                Ellipsize = TextUtils.TruncateAt.Marquee,
                LayoutParameters =
                    new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };
            text2.SetTextSize(ComplexUnitType.Sp, 14);
            text2.SetSingleLine(true);
            text2.SetPadding(2, 2, 2, 2);
            container.AddView(text2);
        }
        private View CreateView(TestRunInfo testRunDetails)
        {
            LinearLayout layout = new LinearLayout(this);
            layout.Orientation = Orientation.Vertical;

            TextView titleTextView = new TextView(this);
            titleTextView.LayoutParameters = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FillParent, 48);

            titleTextView.SetBackgroundColor(Color.Argb(255,50,50,50));
            titleTextView.SetPadding(20,0,20,0);

            titleTextView.Gravity = GravityFlags.CenterVertical;
            titleTextView.Text = testRunDetails.Description;
            titleTextView.Ellipsize = TextUtils.TruncateAt.Start;

            TextView descriptionTextView = new TextView(this);
            descriptionTextView.LayoutParameters = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent)
            {
                LeftMargin = 40,
                RightMargin = 40
            };

           if (testRunDetails.Running)
    		{
				descriptionTextView.Text = "Test is currently running.";
			}
			else if (testRunDetails.Passed)
			{
				descriptionTextView.Text = "wohhoo, Test has passed.";
			}
			else if (testRunDetails.TestResult != null)
			{
				descriptionTextView.Text = testRunDetails.TestResult.Message + "\r\n\r\n" + testRunDetails.TestResult.StackTrace;	
			}

            ScrollView scrollView = new ScrollView(this);
            scrollView.LayoutParameters = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);

            scrollView.AddView(descriptionTextView);

            layout.AddView(titleTextView);
            layout.AddView(scrollView);

            return layout;
        }
 /// <summary>
 /// Find a matching test in the context. If not found then add it.
 /// </summary>
 public static TestRunInfo FindOrAddTestRunInfo(this TestRunContext context, ITest test)
 {
     var testRunItem =
         test.FullName != null
             ? context.TestResults.FirstOrDefault(item => item.TestCaseName == test.FullName)
             : context.TestResults.FirstOrDefault(item => item.Description == test.Name);
     if (testRunItem == null)
     {
         testRunItem = new TestRunInfo
         {
             Description = test.Name,
             TestCaseName = test.FullName,
             IsTestSuite = test is TestSuite,
             IsIgnored = test.IgnoreReason != null
         };
         context.TestResults.Add(testRunItem);
     }
     return testRunItem;
 }
        private View CreateView(TestRunInfo testRunDetails)
        {
            LinearLayout layout = new LinearLayout(this);

            layout.Orientation = Orientation.Vertical;

            TextView titleTextView = new TextView(this);

            titleTextView.LayoutParameters = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FillParent, 48);

            titleTextView.SetBackgroundColor(Color.Argb(255, 50, 50, 50));
            titleTextView.SetPadding(20, 0, 20, 0);

            titleTextView.Gravity   = GravityFlags.CenterVertical;
            titleTextView.Text      = testRunDetails.Description;
            titleTextView.Ellipsize = TextUtils.TruncateAt.Start;

            TextView descriptionTextView = new TextView(this);

            descriptionTextView.LayoutParameters = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent)
            {
                LeftMargin  = 40,
                RightMargin = 40
            };

            descriptionTextView.Text = testRunDetails.TestResult.Message +
                                       "\r\n\r\n" + testRunDetails.TestResult.StackTrace;

            ScrollView scrollView = new ScrollView(this);

            scrollView.LayoutParameters = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);

            scrollView.AddView(descriptionTextView);

            layout.AddView(titleTextView);
            layout.AddView(scrollView);

            return(layout);
        }
        public TestRunDetailsView(Context context, TestRunInfo testRunDetails) : base(context)
        {
            Orientation = Orientation.Vertical;

            var titleTextView = new TextView(context)
            {
                LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.FillParent, 48)
            };

            titleTextView.SetBackgroundColor(Color.Argb(255,50,50,50));
            titleTextView.SetPadding(20,0,20,0);

            titleTextView.Gravity = GravityFlags.CenterVertical;
            titleTextView.Text = testRunDetails.Description;
            titleTextView.Ellipsize = TextUtils.TruncateAt.Start;

            _descriptionTextView = new TextView(context)
            {
                LayoutParameters = new LayoutParams(
                    ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent)
                {
                    LeftMargin = 40,
                    RightMargin = 40
                }
            };

            var scrollView = new ScrollView(context)
            {
                LayoutParameters = new LayoutParams(
                    ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)
            };

            scrollView.AddView(_descriptionTextView);

            AddView(titleTextView);
            AddView(scrollView);
        }
        private View InflateItemView(TestRunInfo itemContent)
        {
            LinearLayout layout = new LinearLayout(_context);
            layout.Orientation = Orientation.Horizontal;
            
            View indicatorView = new View(_context);
            TextView descriptionView = new TextView(_context);

            descriptionView.Ellipsize = Android.Text.TextUtils.TruncateAt.Start;
            descriptionView.Gravity = GravityFlags.CenterVertical;
            
            if(itemContent.IsTestSuite)
            {
                layout.SetBackgroundColor(Color.Argb(255,50,50,50));
                
                indicatorView.LayoutParameters = new LinearLayout.LayoutParams(18, 18)
                {
                    LeftMargin = 14,
                    RightMargin = 14,
                    TopMargin = 14,
                    BottomMargin = 14,
                    Gravity = GravityFlags.CenterVertical
                };

                descriptionView.LayoutParameters = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent)
                {
                    BottomMargin = 14,
                    TopMargin = 14,
                    RightMargin = 14,
                    Height = 48,
                    Gravity = GravityFlags.CenterVertical
                };
            }
            else
            {
                indicatorView.LayoutParameters = new LinearLayout.LayoutParams(18, LinearLayout.LayoutParams.FillParent)
                {
                    RightMargin = 20
                };

                descriptionView.LayoutParameters = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent)
                {
                    BottomMargin = 20,
                    TopMargin = 20,
                    RightMargin = 20,
                    Gravity = GravityFlags.CenterVertical
                };
            }

            layout.AddView(indicatorView);
            layout.AddView(descriptionView);

            layout.Tag = new TestResultViewHolder(indicatorView,descriptionView);

            return layout;
        }
        public TestResultsListView(Context context, TestRunInfo itemContent) : base(context)
        {
            Orientation = Orientation.Horizontal;
            
            var indicatorView = new View(context);
            indicatorView.SetBackgroundColor(
                itemContent.IsIgnored ? Color.Yellow
                : itemContent.Running ? Color.Gray
                : itemContent.Passed ? Color.Green
                : Color.Red);

            var descriptionView = new TextView(context)
            {
                Ellipsize = Android.Text.TextUtils.TruncateAt.Start,
                Gravity = GravityFlags.CenterVertical,
                Text = itemContent.Description
            };

            if(itemContent.IsTestSuite)
            {
                SetBackgroundColor(Color.Argb(255,50,50,50));
                
                indicatorView.LayoutParameters = new LayoutParams(18, 18)
                {
                    LeftMargin = 14,
                    RightMargin = 14,
                    TopMargin = 14,
                    BottomMargin = 14,
                    Gravity = GravityFlags.CenterVertical
                };

                descriptionView.LayoutParameters = new LayoutParams(
                    ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)
                {
                    BottomMargin = 14,
                    TopMargin = 14,
                    RightMargin = 14,
                    Height = 48,
                    Gravity = GravityFlags.CenterVertical
                };
            }
            else
            {
                indicatorView.LayoutParameters = new LayoutParams(
                    18, ViewGroup.LayoutParams.FillParent)
                {
                    RightMargin = 20
                };

                descriptionView.LayoutParameters = new LayoutParams(
                    ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)
                {
                    BottomMargin = 20,
                    TopMargin = 20,
                    RightMargin = 20,
                    Gravity = GravityFlags.CenterVertical
                };
            }

            AddView(indicatorView);
            AddView(descriptionView);
        }