protected virtual void PresentTestFixture(CSUnitTestFixtureElement value, IPresentableItem item,
                                                  TreeModelNode modelNode, PresentationState state)
        {
            item.Clear();
            if (IsNodeParentNatural(modelNode, value))
            {
                item.RichText = new CLRTypeName(value.GetTypeClrName()).ShortName;
            }
            else
            {
                var name = new CLRTypeName(value.GetTypeClrName());
                if (string.IsNullOrEmpty(name.NamespaceName))
                {
                    item.RichText = string.Format("{0}", name.ShortName);
                }
                else
                {
                    item.RichText = string.Format("{0}.{1}", name.NamespaceName, name.ShortName);
                }
            }

            Image typeImage  = UnitTestManager.GetStandardImage(UnitTestElementImage.TestContainer);
            Image stateImage = UnitTestManager.GetStateImage(state);

            if (stateImage != null)
            {
                item.Images.Add(stateImage);
            }
            else if (typeImage != null)
            {
                item.Images.Add(typeImage);
            }
            AppendOccurencesCount(item, modelNode, "test");
        }
        protected virtual void PresentTest(CSUnitTestElement value, IPresentableItem item, TreeModelNode modelNode,
                                           PresentationState state)
        {
            item.Clear();
            if (value.Fixture.GetTypeClrName() != value.GetTypeClrName())
            {
                item.RichText = string.Format("{0}.{1}", new CLRTypeName(value.GetTypeClrName()).ShortName, value.MethodName);
            }
            else
            {
                item.RichText = value.MethodName;
            }

            if (value.IsExplicit)
            {
                item.RichText.SetForeColor(SystemColors.GrayText);
            }

            Image typeImage  = UnitTestManager.GetStandardImage(UnitTestElementImage.Test);
            Image stateImage = UnitTestManager.GetStateImage(state);

            if (stateImage != null)
            {
                item.Images.Add(stateImage);
            }
            else if (typeImage != null)
            {
                item.Images.Add(typeImage);
            }
        }
        static void SetImage(IPresentableItem item, PresentationState state, UnitTestElementImage imageType)
        {
            Image stateImage = UnitTestManager.GetStateImage(state);
            Image typeImage  = UnitTestManager.GetStandardImage(imageType);

            if (stateImage != null)
            {
                item.Images.Add(stateImage);
            }
            else if (typeImage != null)
            {
                item.Images.Add(typeImage);
            }
        }
        private void PresentTestElement(GallioTestElement value, IPresentableItem item,
                                        TreeModelNode modelNode, PresentationState state)
        {
            item.Clear();

            item.RichText = value.TestName;

#if RESHARPER_60_OR_NEWER
            if (value.Explicit)
            {
                item.RichText.SetForeColor(SystemColors.GrayText);
            }

            var typeImage  = UnitTestIconManager.GetStandardImage(UnitTestElementImage.Test);
            var stateImage = UnitTestIconManager.GetStateImage(state);
            if (stateImage != null)
            {
                item.Images.Add(stateImage);
            }
            else if (typeImage != null)
            {
                item.Images.Add(typeImage);
            }
#else
            if (value.IsExplicit)
            {
                item.RichText.SetForeColor(SystemColors.GrayText);
            }

            Image image = UnitTestManager.GetStateImage(state);

            if (image == null)
            {
                image = UnitTestManager.GetStandardImage(value.IsTestCase ? UnitTestElementImage.Test : UnitTestElementImage.TestCategory);
            }

            if (image != null)
            {
                item.Images.Add(image);
            }

            if (!value.IsTestCase)
            {
                AppendOccurencesCount(item, modelNode, "test");
            }
#endif
        }
Beispiel #5
0
        public void Present(UnitTestElement element, IPresentableItem item, TreeModelNode node, PresentationState state)
        {
            var testElement = element as StorEvilUnitTestElement;

            if (testElement == null)
            {
                return;
            }

            item.RichText = element.ShortName;

            Image standardImage = UnitTestManager.GetStandardImage(UnitTestElementImage.Test);
            Image stateImage    = UnitTestManager.GetStateImage(state);

            if (stateImage != null)
            {
                item.Images.Add(stateImage);
            }
            else if (standardImage != null)
            {
                item.Images.Add(standardImage);
            }
        }