Пример #1
0
        public static TestProject CreateTestProjectWithTestClassTestMethods(IProject project, string className, string[] methodNames)
        {
            MockRegisteredTestFrameworks testFrameworks = new MockRegisteredTestFrameworks();
            MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();

            c.MockProjectContent.Project = project;
            c.SetDotNetName(className);
            c.CompilationUnit.FileName = @"c:\projects\tests\MyTests.cs";
            TestClass testClass = new TestClass(c, testFrameworks);

            foreach (string methodName in methodNames)
            {
                MockMethod method = new MockMethod(c, methodName);
                method.Region = new DomRegion(4, 20);
                c.Methods.Add(method);

                TestMember testMember = new TestMember(method);
                testClass.TestMembers.Add(testMember);
            }

            c.Project.Name = "TestProject";
            TestProject testProject = new TestProject(c.Project, c.ProjectContent, testFrameworks);

            testProject.TestClasses.Add(testClass);

            return(testProject);
        }
Пример #2
0
        public static MockClass CreateClassWithBaseType(string baseTypeName)
        {
            MockClass baseType = MockClass.CreateMockClassWithoutAnyAttributes();

            baseType.FullyQualifiedName = baseTypeName;
            MockClass c = MockClass.CreateMockClassWithoutAnyAttributes();

            c.BaseTypes.Add(new DefaultReturnType(baseType));
            return(c);
        }
Пример #3
0
        public static MockMethod CreateMockMethodWithAttributes(IList <MockAttribute> attributes)
        {
            MockClass  mockClass  = MockClass.CreateMockClassWithoutAnyAttributes();
            MockMethod mockMethod = new MockMethod(mockClass);

            foreach (MockAttribute attribute in attributes)
            {
                mockMethod.Attributes.Add(attribute);
            }

            return(mockMethod);
        }