Program.cs :  » Testing » SystiN » Systin_Console » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Testing » SystiN 
SystiN » Systin_Console » Program.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Systin.Library;
using TownleyEnterprises.Command;

namespace Systin_Console{
    class Program
    {

        #region SystinOptions Class
        private class SystinOptions : ICommandListener
        {

            private string mInputFile = "";
            public string InputFile
            {
                get { return mInputFile; }
            }

            private string mDriver = "";
            public string Driver
            {
                get { return mDriver; }
            }
  
  

            #region Command Options
            private static CommandOption _inputFile = new CommandOption("InputFile",
                    'i', true, null,
                    "Path to Test File");

            private static CommandOption _languageDriver = new CommandOption(
                        "Driver",
                        'd',
                        true,
                        null,
                        "specify the path to the language Library dll");



            private static CommandOption[] _mainopts = {
                 _inputFile, _languageDriver };


            #endregion


            #region ICommandListener Members

            public string Description
            {
                get { return "Description of stuff"; }
            }

            public CommandOption[] Options
            {
                get { return _mainopts; }
            }

            public void OptionMatched(CommandOption opt, string arg)
            {
               
                if(opt.LongName.Equals("InputFile")){
                    this.mInputFile = opt.ArgValue.ToString();
                }
                if(opt.LongName.Equals("Driver")){
                    this.mDriver = opt.ArgValue.ToString();
                }
                
            }

            #endregion
        }

        
        #endregion

        #region Private Util Methods
        
        private int Run(string[] cmdLine)
        {            
            
            return 0;
        }

        private  void ProcessSingleLanguageDll()
        {
            
            //FileInfo inputFile = ValidateFile();
            //DllLoader dllLoader = DllLoader.LoadDll(inputFile);
            
        }

        private  void DetermineUnhandledArguments()
        {
            // For error handling, were any switches handled?
            //string[] unhandled = parser.UnhandledSwitches;
            //if (unhandled.Length > 0)
            //{
            //    Console.WriteLine("\nThe following switches were not handled.");
            //    foreach (string s in unhandled)
            //        Console.WriteLine("  - {0}", s);
            //}
        }

        #endregion

        #region Main Method
        [STAThread]
        static int Main(string[] args)
        {
            //Parse the command Line looking for options
            CommandParser _parser = new CommandParser("Systin");
            SystinOptions options = new SystinOptions();
            _parser.AddCommandListener(options);
            _parser.Parse(args);

            //If either inputfile or driver is empty thow an error message
            if (options.InputFile.Length == 0 || options.Driver.Length == 0)
            {
                Console.WriteLine("InputFile and Driver path are both required parameters");
                _parser.Usage();
                return -1;
            }

            //Make sure both files are actual files
            FileInfo testInputFile = Validate(options.InputFile.ToString());
            FileInfo languageDriver = Validate(options.Driver.ToString());


            //Process Input Test File
            TestFileLoader fr = TestFileLoader.OpenAndProcessInputFile(testInputFile);
            DllLoader driver = DllLoader.LoadDll(languageDriver);

            SystinEngine.ExecuteTestFile(fr.Instructions, ref driver);
            return 0;

        }

        private static FileInfo Validate(string p)
        {
            if (p == null)
            {
                throw new ArgumentNullException("p");
            }

            if(p.Length == 0){
                throw new ArgumentNullException("p");
            }

            FileInfo file = new FileInfo(p);
            
            

            return file;

        }

        #endregion       
        
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.