StarTeamTest.cs :  » Build-Systems » CruiseControl.NET » ThoughtWorks » CruiseControl » UnitTests » Core » Sourcecontrol » 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 » Build Systems » CruiseControl.NET 
CruiseControl.NET » ThoughtWorks » CruiseControl » UnitTests » Core » Sourcecontrol » StarTeamTest.cs
using System;
using System.Globalization;
using Exortech.NetReflector;
using NUnit.Framework;
using ThoughtWorks.CruiseControl.Core.Sourcecontrol;
using ThoughtWorks.CruiseControl.Core.Util;

namespace ThoughtWorks.CruiseControl.UnitTests.Core.Sourcecontrol{
  [TestFixture]
  public class StarTeamTest : CustomAssertion
  {
    public const string ST_XML =
      @"<sourceControl type=""starteam"" autoGetSource=""true"">
        <executable>..\tools\starteam\stcmd.exe</executable>
        <username>Admin</username>
        <password>admin</password>
        <host>10.1.1.64</host>
        <port>49201</port>
        <project>.NET LAB</project>
        <path>CC.NET/starteam-ccnet</path>        
      </sourceControl>";  

    private StarTeam starteam;

    [SetUp]
    protected void SetUp()
    {
      starteam = CreateStarTeam();
    }
    
    [Test]
    public void VerifyFormatOfHistoryProcessArguments()
    {        
      DateTime from = new DateTime(2001, 1, 21, 20, 0, 0);
      DateTime to = new DateTime(2002, 2, 22, 20, 0, 0);

      ProcessInfo actual = starteam.CreateHistoryProcessInfo(from, to);      

      string expectedExecutable = @"..\tools\starteam\stcmd.exe";
      string expectedArgs = "hist -nologo -x -is -filter IO -p \"Admin:admin@10.1.1.64:49201/.NET LAB/CC.NET/starteam-ccnet\" \"*\"";

      Assert.IsNotNull(actual);
      Assert.AreEqual(expectedExecutable, actual.FileName);
      Assert.AreEqual(expectedArgs, actual.Arguments);
    }    
    
    [Test]
    public void VerifyFormatOfGetSourceProcessArguments()
    {        
      string args = starteam.GetSourceProcessArgs();      
      Assert.AreEqual("co -nologo -ts -x -is -q -f NCO -p \"Admin:admin@10.1.1.64:49201/.NET LAB/CC.NET/starteam-ccnet\" \"*\"", args);
    }
    
    [Test]
    public void VerifyValuesSetByNetReflector()
    {      
      Assert.AreEqual(@"..\tools\starteam\stcmd.exe", starteam.Executable);
      Assert.AreEqual("Admin", starteam.Username);
      Assert.AreEqual("admin", starteam.Password);
      Assert.AreEqual("10.1.1.64", starteam.Host);
      Assert.AreEqual(49201, starteam.Port);
      Assert.AreEqual(".NET LAB", starteam.Project);
      Assert.AreEqual("CC.NET/starteam-ccnet", starteam.Path);
      Assert.AreEqual(true, starteam.AutoGetSource);
    }

    [Test]
    public void FormatDate()
    {
      starteam.Culture = new CultureInfo("en-US", false);
      DateTime date = new DateTime(2002, 2, 22, 20, 0, 0);
      string expected = "2/22/2002 8:00:00 PM";
      string actual = starteam.FormatCommandDate(date);
      Assert.AreEqual(expected, actual);

      date = new DateTime(2002, 2, 22, 12, 0, 0);
      expected = "2/22/2002 12:00:00 PM";
      actual = starteam.FormatCommandDate(date);
      Assert.AreEqual(expected, actual);
    }

    [Test]
    public void VerifyDefaultExecutable()
    {
      Assert.AreEqual("stcmd.exe", new StarTeam().Executable);
    }

    [Test]
    public void VerifyDefaultHost()
    {
      Assert.AreEqual("127.0.0.1", new StarTeam().Host);
    }

    [Test]
    public void VerifyDefaultPort()
    {
      Assert.AreEqual(49201, new StarTeam().Port);
    }

    [Test]
    public void VerifyDefaultPath()
    {
      Assert.AreEqual(String.Empty, new StarTeam().Path);
    }
    
    private StarTeam CreateStarTeam()
    {
      StarTeam starTeam = new StarTeam();
      NetReflector.Read(ST_XML, starTeam);
      return starTeam;
    }
  }   
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.