public TestBaseClassTemplate(ProjectModelBase unitTestProjectLocation, UnitTestCreationDetails unitTestCreationOptions)
        {
            this.unitTestProjectLocation = unitTestProjectLocation;
            this.unitTestCreationOptions = unitTestCreationOptions;

            this.usings.Add(this.unitTestCreationOptions.ClassUnderTestNamespace);
            this.usings.AddRange(this.unitTestCreationOptions.ClassUnderTestConstructor.Parameters.SelectMany(p => p.Namespaces));
        }
        private static async Task <ProjectModelBase> GetUnitTestProjectLocationAsync(ProjectModelBase locationForTest, UnitTestCreationDetails creationOptions, bool shouldCreateParentFolder)
        {
            if (shouldCreateParentFolder)
            {
                return(await locationForTest.AddFolderAsync(creationOptions.UnitTestFolderName));
            }

            return(locationForTest);
        }
        internal static async Task <IEnumerable <FileModel> > InstantiateAsync(ProjectModelBase selectedProjectNode, UIAutomationTestCreationOptions automationTestOptions)
        {
            var testFolder = await AddAutomationTestFolderAsync(selectedProjectNode, automationTestOptions);

            return(await Task.WhenAll(
                       AddAutomationTestClassAsync(testFolder, automationTestOptions),
                       AddAutomationPageClassAsync(testFolder, automationTestOptions),
                       AddAutomationPageElementMapClassAsync(testFolder, automationTestOptions),
                       AddAutomationPageValidatorClassAsync(testFolder, automationTestOptions)));
        }
Exemplo n.º 4
0
 public UnitTestCreationOptions(
     ProjectModelBase locationForTest,
     UnitTestCreationDetails unitTestCreationDetails,
     bool shouldCreateParentFolder,
     bool shouldCreateUnitTestBaseClass)
 {
     this.LocationForTest               = locationForTest;
     this.UnitTestCreationDetails       = unitTestCreationDetails;
     this.ShouldCreateParentFolder      = shouldCreateParentFolder;
     this.ShouldCreateUnitTestBaseClass = shouldCreateUnitTestBaseClass;
 }
 public TestTemplate(ProjectModelBase testLocation, UIAutomationTestCreationOptions automationTestOptions)
 {
     this.testLocation          = testLocation;
     this.automationTestOptions = automationTestOptions;
 }
        private static async Task <FileModel> AddUnitTestClassAsync(ProjectModelBase unitTestProjectLocation, UnitTestCreationDetails unitTestCreationOptions)
        {
            var unitTestClass = new TestClassTemplate(unitTestProjectLocation, unitTestCreationOptions);

            return(await unitTestProjectLocation.AddFileAsync(unitTestCreationOptions.UnitTestClassFileName, unitTestClass.TransformText()));
        }
 private static async Task <ProjectModelBase> AddAutomationTestFolderAsync(ProjectModelBase locationForTest, UIAutomationTestCreationOptions creationOptions)
 {
     return(await locationForTest.AddFolderAsync(creationOptions.TestFolderName));
 }
        private static async Task <FileModel> AddAutomationTestClassAsync(ProjectModelBase testFolder, UIAutomationTestCreationOptions automationTestOptions)
        {
            var unitTestClass = new TestTemplate(testFolder, automationTestOptions);

            return(await testFolder.AddFileAsync($"{automationTestOptions.TestClassName}.cs", unitTestClass.TransformText()));
        }