예제 #1
0
        /// <summary>
        /// Sets the test method.
        /// </summary>
        /// <param name="testMethodMode">The test method.</param>
        /// <param name="direction">Indicates where the set came from.</param>
        public void SetTestMethodMode(TestMethodMode testMethodMode, ActionDirection direction)
        {
            if (direction == ActionDirection.FromController)
            {
                this.view.SetIncludeUnitTestPerOperation(testMethodMode == TestMethodMode.IncludeIndividualOperations);
            }

            this.wizardData.Configuration.testMethodMode = testMethodMode;
        }
예제 #2
0
        /// <summary>
        /// Initialises a new instance of the <see cref="UnitTestGenerator"/> class.
        /// </summary>
        /// <param name="scenarioName">The name of the scenario.</param>
        /// <param name="namespaceName">The name of the namespace in which to place the unit test class.</param>
        /// <param name="unitTestClassName">The name to be given to the unit test class.</param>
        /// <param name="testMethodMode">Whether to include the test methods for the individual operations or not.</param>
        /// <param name="operationTimerMode">Whether to include timers for the individual operations or not.</param>
        public UnitTestGenerator(string scenarioName, string namespaceName, string unitTestClassName, TestMethodMode testMethodMode, OperationTimerMode operationTimerMode)
        {
            this.scenarioName       = scenarioName;
            this.testMethodMode     = testMethodMode;
            this.operationTimerMode = operationTimerMode;

            this.mainCcu           = new CodeCompileUnit();
            this.mainTestNamespace = new CodeNamespace(namespaceName);
            this.mainCcu.Namespaces.Add(this.mainTestNamespace);

            this.stubCcu           = new CodeCompileUnit();
            this.stubTestNamespace = new CodeNamespace(namespaceName);
            this.stubCcu.Namespaces.Add(this.stubTestNamespace);

            this.mainTestType = this.GenerateMainTestClass(unitTestClassName);
            this.stubTestType = this.GenerateStubTestClass(unitTestClassName);

            this.mainTestNamespace.Imports.Add(new CodeNamespaceImport("Microsoft.VisualStudio.TestTools.UnitTesting"));
            this.mainTestNamespace.Imports.Add(new CodeNamespaceImport("System.Collections.Generic"));
        }