Esempio n. 1
0
        public void AddTestFailureAfterAllTestsPassed()
        {
            AllTestMethodsPass();

            MockClass  c           = MockClass.CreateMockClassWithoutAnyAttributes();
            MockMethod mockMethod  = new MockMethod(c, "TestMethod4");
            TestMember testMethod4 = new TestMember(mockMethod);

            testMethod4.Result = TestResultType.Failure;
            testMethods.Add(testMethod4);

            Assert.AreEqual(TestResultType.Failure, testMethods.Result);
        }
		public void Init()
		{
			testMethodsResultChanged = false;
			testMethods = new TestMemberCollection();
			
			// TestMethod1.
			MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();
			MockMethod mockMethod = new MockMethod(c, "TestMethod1");
			testMethod1 = new TestMember(mockMethod);
			testMethods.Add(testMethod1);
			
			// TestMethod2.
			mockMethod = new MockMethod(c, "TestMethod2");
			testMethod2 = new TestMember(mockMethod);
			testMethods.Add(testMethod2);
		
			// TestMethod3.
			mockMethod = new MockMethod(c, "TestMethod3");
			testMethod3 = new TestMember(mockMethod);
			testMethods.Add(testMethod3);
			
			testMethods.ResultChanged += TestMethodsResultChanged;
		}
Esempio n. 3
0
        public void Init()
        {
            testMethodsResultChanged = false;
            testMethods = new TestMemberCollection();

            // TestMethod1.
            MockClass  c          = MockClass.CreateMockClassWithoutAnyAttributes();
            MockMethod mockMethod = new MockMethod(c, "TestMethod1");

            testMethod1 = new TestMember(mockMethod);
            testMethods.Add(testMethod1);

            // TestMethod2.
            mockMethod  = new MockMethod(c, "TestMethod2");
            testMethod2 = new TestMember(mockMethod);
            testMethods.Add(testMethod2);

            // TestMethod3.
            mockMethod  = new MockMethod(c, "TestMethod3");
            testMethod3 = new TestMember(mockMethod);
            testMethods.Add(testMethod3);

            testMethods.ResultChanged += TestMethodsResultChanged;
        }
Esempio n. 4
0
		/// <summary>
		/// Gets the test members for the specified class.
		/// </summary>
		TestMemberCollection GetTestMembers(IClass c)
		{
			TestMemberCollection testMembers = new TestMemberCollection();
			foreach (var member in testFrameworks.GetTestMembersFor(c))
				if (!testMembers.Contains(member.Name)) {
					testMembers.Add(member);
				}
			
			// Add base class test members.
			IClass declaringType = c;
			while (c.BaseClass != null)
			{
				foreach (var testMember in testFrameworks.GetTestMembersFor(c.BaseClass)) {
					BaseTestMember baseTestMethod = new BaseTestMember(declaringType, testMember.Member);
					TestMember testMethod = new TestMember(c.BaseClass, baseTestMethod);
					if (testMember.Member.IsVirtual) {
						if (!testMembers.Contains(testMember.Name)) {
							testMembers.Add(testMethod);
						}
					} else {
						if (!testMembers.Contains(testMethod.Name)) {
							testMembers.Add(testMethod);
						}
					}
				}
				c = c.BaseClass;
			}

			baseClassesFQNames.Clear();
			foreach (var memberDeclaringClass in testMembers.Select(member => member.DeclaringType).Distinct())
				if (memberDeclaringClass.CompareTo(declaringType) != 0)
					baseClassesFQNames.Add(memberDeclaringClass.FullyQualifiedName);
			return testMembers;
		}