public void Init() { testMethodsResultChanged = false; testMethods = new TestMethodCollection(); // TestMethod1. MockMethod mockMethod = new MockMethod("TestMethod1"); testMethod1 = new TestMethod(mockMethod); testMethods.Add(testMethod1); // TestMethod2. mockMethod = new MockMethod("TestMethod2"); testMethod2 = new TestMethod(mockMethod); testMethods.Add(testMethod2); // TestMethod3. mockMethod = new MockMethod("TestMethod3"); testMethod3 = new TestMethod(mockMethod); testMethods.Add(testMethod3); testMethods.ResultChanged += TestMethodsResultChanged; }
private void PlugIn1_DecorateLanguageElement(object sender, DecorateLanguageElementEventArgs args) { LanguageElement element = args.LanguageElement; if (element.ElementType == LanguageElementType.Attribute) { DevExpress.CodeRush.StructuralParser.Attribute attribute = (DevExpress.CodeRush.StructuralParser.Attribute)element; if (attribute.TargetNode.ElementType == LanguageElementType.Method) { Method target = (Method)attribute.TargetNode; TestMethodCollection tests = CodeRush.UnitTests.Tests; foreach (TestMethod test in tests) { if (target.Location == test.FullName) { CreateErrorArrowAdornment(args, attribute, target, test); CreateAttributeShadeAdornment(args, attribute, target, test.Status); //OverlayErrorNextToAssert(ea, test); } } } } }
public void Init() { testMethodsResultChanged = false; testMethods = new TestMethodCollection(); // TestMethod1. MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); MockMethod mockMethod = new MockMethod(c, "TestMethod1"); testMethod1 = new TestMethod(mockMethod); testMethods.Add(testMethod1); // TestMethod2. mockMethod = new MockMethod(c, "TestMethod2"); testMethod2 = new TestMethod(mockMethod); testMethods.Add(testMethod2); // TestMethod3. mockMethod = new MockMethod(c, "TestMethod3"); testMethod3 = new TestMethod(mockMethod); testMethods.Add(testMethod3); testMethods.ResultChanged += TestMethodsResultChanged; }
/// <summary> /// Gets the test methods for the specified class. /// </summary> static TestMethodCollection GetTestMethods(IClass c) { TestMethodCollection testMethods = new TestMethodCollection(); foreach (IMethod method in c.Methods) { if (TestMethod.IsTestMethod(method)) { if (!testMethods.Contains(method.Name)) { testMethods.Add(new TestMethod(method)); } } } // Add base class test methods. IClass declaringType = c; while (c.BaseClass != null) { foreach (IMethod method in c.BaseClass.Methods) { if (TestMethod.IsTestMethod(method)) { BaseTestMethod baseTestMethod = new BaseTestMethod(declaringType, method); TestMethod testMethod = new TestMethod(c.BaseClass.Name, baseTestMethod); if (method.IsVirtual) { if (!testMethods.Contains(method.Name)) { testMethods.Add(testMethod); } } else { if (!testMethods.Contains(testMethod.Name)) { testMethods.Add(testMethod); } } } } c = c.BaseClass; } return testMethods; }
/// <summary> /// Gets the test methods for the class. /// </summary> void GetTestMethods() { testMethods = GetTestMethods(c); testMethods.ResultChanged += TestMethodsResultChanged; }