コード例 #1
0
 public void UCodeBuilder(string filePath, string directory, string className)
 {
     codeEngine.UCodeGenerator(filePath, directory, className);
     UCodeGen.FilesToInclude.Add(Path.Combine(directory, className));
     //string projectName = Path.GetFileName(System.Reflection.Assembly.GetCallingAssembly().Location).Replace(".dll","");
     //AutomateAddFile.IncludeInProject(projectName, Path.Combine(filePath,Directory, className + ".cs"));
 }
コード例 #2
0
        public void UCodeConfigGen(string filePath, string directory)
        {
            string testIntialiseCodeSnippet    = File.ReadAllText("..//..//" + snippetParentFolder + "//testIntializeSnipp.txt");
            string testCleanupCodeSnippet      = File.ReadAllText("..//..//" + snippetParentFolder + "//testCleanUpSnipp.txt");
            string testClearBrowserCodeSnippet = File.ReadAllText("..//..//" + snippetParentFolder + "//clrBrowserSnipp.txt");
            Dictionary <string, string> testInitialiseAttributes = new Dictionary <string, string>()
            {
                { "TestInitialize", "" },
            };
            Dictionary <string, string> testCleanupAttributes = new Dictionary <string, string>()
            {
                { "TestCleanup", "" },
            };
            string reportInstance = "Instance";
            Dictionary <string, string> memberCollection = new Dictionary <string, string>();

            memberCollection.Add("OpenQA.Selenium.IWebDriver,UnifiedFramework", "driver");
            memberCollection.Add("System.String", "textFile");
            memberCollection.Add("UnifiedFramework.UnifiedReports.UnifiedReports,UnifiedFramework", "unifiedReport");
            memberCollection.Add("UnifiedFramework.UnifiedReports.UnifiedTest,UnifiedFramework", "unifiedTestLog");
            memberCollection.Add("OpenQA.Selenium.Support.UI.WebDriverWait,UnifiedFramework", "wait");
            memberCollection.Add("UnifiedFrameWork.Controller.UComponentController", "unifiedComponent");

            UCodeEngine codeEngine = new UCodeEngine(nameSpace, localUsingCollection, className, "TestClass");

            codeEngine.UCodeAddMembers(memberCollection);
            codeEngine.UCodeAddCollectionMembers("List", "unifiedLogCollection", "UnifiedFramework.UnifiedReports.UnifiedTest,UnifiedFramework");
            codeEngine.UCodeAddMethodSnippet(testIntialiseCodeSnippet, "TestIntialise", testInitialiseAttributes);
            codeEngine.UCodeAddMethodSnippet(testCleanupCodeSnippet, "TestCleanUp", testCleanupAttributes);
            codeEngine.UCodeAddMethodSnippet(testClearBrowserCodeSnippet, "ClearBrowser");
            codeEngine.UCodeAddReportProperty(reportInstance, "UnifiedReports", "UReportsTitle", "UReportsHeadline");
            codeEngine.UCodeGenerator(filePath, directory, className);

            //Include file in project
            UCodeGen.FilesToInclude.Add(Path.Combine(directory, className));
        }