LanguageDriver.cs :  » Testing » SystiN » LanguageLibrary » 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 » LanguageLibrary » LanguageDriver.cs
using System;
using System.Collections.Generic;
using System.Text;
using Systin.Library;
using WatiN.Core;
using System.Threading;
using System.Reflection;
using System.IO;


namespace LanguageLibrary{
    [LanguageDriver]    
    public class LanguageDriverTestClass
    {
        private Stack<string> mCallStack = new Stack<string>();
        public Stack<string> CallStack
        {
            get { return mCallStack; }
        }    

        [Systin]
        public void Log_Into_system()
        {

            this.mCallStack.Push("Log_Into_system");
            Log.Message(MethodInfo.GetCurrentMethod().Name);
        }
        [Systin]
        public void Log_Into_System_fully()
        {
            Set_User_Name();
            Press_Login_Button();
            Set_Password();
            this.mCallStack.Push("Log_Into_System_fully");

            Log.Message(MethodInfo.GetCurrentMethod().Name);
        }
        [Systin]
        public void Go_to_google()
        {
            IE ie = null;

            try
            {
                // Open an new Internet Explorer Window and

                // goto the google website.

                ie = new IE("http://www.google.com");



                // Find the search text field and type Watin in it.

                ie.TextField(Find.ByName("q")).TypeText("WatiN");

                // Click the Google search button.

                ie.Button(Find.ByValue("Google Search")).Click();
            }
            finally
            {
                ie.Close();
            }

            Log.Message(MethodInfo.GetCurrentMethod().Name);

        }
        [Systin]
        public void Press_Login_Button()
        {
            this.mCallStack.Push("Press_Login_Button");

            Log.Message(MethodInfo.GetCurrentMethod().Name);
        }

        [Systin]
        public void Set_User_Name()
        {
            this.mCallStack.Push("Set_User_Name");

            Log.Message(MethodInfo.GetCurrentMethod().Name);
        }
        [Systin]
        public void Set_Password()
        {
            this.mCallStack.Push("Set_Password");
            Log.Message(MethodInfo.GetCurrentMethod().Name);
        }
        [Systin]
        public void Click_Time_button()
        {
            this.mCallStack.Push("Click_Time_button");

            Log.Message(MethodInfo.GetCurrentMethod().Name);
        }

        public void Bad_Method_Not_Tagged()
        {
            this.mCallStack.Push("Bad_Method_Not_Tagged");

            Log.Message(MethodInfo.GetCurrentMethod().Name);
        }

        [Systin]
        public void Bad_Method_Programmed_Incorrectly()
        {
            String test = null;
            //Throw an exception
            try
            {
                test.Equals("something");

            }
            catch (Exception e)
            {
                Log.Message(MethodInfo.GetCurrentMethod().Name);
                Log.Message(e.InnerException.ToString());
                throw e;
            }
            
        }
            
        
    }

    public class BadLanguageDriverTestClass { }

    internal class Log
    {
        private static string baseLineLogFile = "Baseline.log";

        public static void Message(String message)
        {
            string currentDirectory = System.IO.Directory.GetCurrentDirectory();
            string baseLineFile = Path.Combine(currentDirectory, baseLineLogFile);

            if (!File.Exists(baseLineFile))
            {
                File.Create(baseLineFile);
            }

            try
            {
                File.AppendAllText(baseLineFile, message + "\r\n");

            }
            catch (Exception)
            {
                
            }
        }
        
    }

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