예제 #1
0
 public void TestFixtureSetUp()
 {
     connection           = new SynergyConnectionInfo();
     connection.Host      = "localhost";
     connection.Database  = @"\\server\share\mydb";
     connection.Delimiter = '-';
     project = new SynergyProjectInfo();
     project.ProjectSpecification = "MyProject-MyProject_Int";
 }
        public void DatabaseName()
        {
            // test non-default configured values
            SynergyConnectionInfo info = new SynergyConnectionInfo();

            info.Database = @"\\myserver\share\mydatabase";
            Assert.AreEqual(@"mydatabase", info.DatabaseName);

            info.Database = @"\\myserver\share\mydatabase\";
            Assert.AreEqual(@"mydatabase", info.DatabaseName);
        }
        public void DatabaseName()
        {
            // test non-default configured values
            SynergyConnectionInfo info = new SynergyConnectionInfo();

            info.Database = System.IO.Path.DirectorySeparatorChar + System.IO.Path.Combine("myserver", "share", "mydatabase");
            Assert.AreEqual(@"mydatabase", info.DatabaseName);

            info.Database = System.IO.Path.DirectorySeparatorChar + System.IO.Path.Combine("myserver", "share", "mydatabase") + System.IO.Path.DirectorySeparatorChar;
            Assert.AreEqual(@"mydatabase", info.DatabaseName);
        }
        public void GetReconfigureTimeShouldHandleNonUSDates()
        {
            string dateString  = "samedi 2 décembre 2006";
            IMock  mockCommand = new DynamicMock(typeof(ISynergyCommand));

            mockCommand.ExpectAndReturn("Execute", ProcessResultFixture.CreateSuccessfulResult(dateString), new IsAnything());
            SynergyConnectionInfo connectionInfo = new SynergyConnectionInfo();

            connectionInfo.FormatProvider = new CultureInfo("FR-fr");
            Synergy  synergy = new Synergy(connectionInfo, new SynergyProjectInfo(), (ISynergyCommand)mockCommand.MockInstance, null);
            DateTime time    = synergy.GetReconfigureTime();

            mockCommand.Verify();
        }
        public void GetReconfigureTimeShouldHandleNonUSDates()
        {
            string dateString  = "samedi 2 décembre 2006";
            var    mockCommand = new Mock <ISynergyCommand>();

            mockCommand.Setup(command => command.Execute(It.IsAny <ProcessInfo>())).Returns(ProcessResultFixture.CreateSuccessfulResult(dateString)).Verifiable();
            SynergyConnectionInfo connectionInfo = new SynergyConnectionInfo();

            connectionInfo.FormatProvider = new CultureInfo("FR-fr");
            Synergy  synergy = new Synergy(connectionInfo, new SynergyProjectInfo(), (ISynergyCommand)mockCommand.Object, null);
            DateTime time    = synergy.GetReconfigureTime();

            mockCommand.Verify();
        }
예제 #6
0
        public void ConnectionDefaults()
        {
            SynergyConnectionInfo actual = new SynergyConnectionInfo();

            Assert.IsNull(actual.Database, "#A1");
            Assert.IsNull(actual.SessionId, "#A2");
            Assert.AreEqual(3600, actual.Timeout, "#A3");
            Assert.AreEqual("ccm.exe", actual.Executable, "#A4");
            Assert.AreEqual(Environment.ExpandEnvironmentVariables("%USERNAME%"), actual.Username, "#A5");
            Assert.AreEqual("build_mgr", actual.Role, "#A6");
            Assert.AreEqual('-', actual.Delimiter, "#A7");
            Assert.AreEqual(Environment.ExpandEnvironmentVariables(@"%SystemDrive%\cmsynergy\%USERNAME%"), actual.HomeDirectory, "#A8");
            Assert.AreEqual(Environment.ExpandEnvironmentVariables(@"%SystemDrive%\cmsynergy\uidb"), actual.ClientDatabaseDirectory, "#A9");
            Assert.AreEqual(Environment.ExpandEnvironmentVariables(@"%ProgramFiles%\Telelogic\CM Synergy 6.3\bin"), actual.WorkingDirectory, "#A10");
        }
        public void TestFixtureSetUp()
        {
            Synergy synergy = (Synergy)NetReflector.Read(SynergyMother.ConfigValues);

            connection                         = synergy.Connection;
            connection.Host                    = "localhost";
            connection.Username                = "******";
            connection.Password                = "******";
            connection.Role                    = "build_mgr";
            connection.Database                = @"\\server\share\dbname";
            connection.Delimiter               = '-';
            connection.WorkingDirectory        = @"C:\Program Files\Telelogic\CM Synergy 6.3\bin";
            connection.HomeDirectory           = @"C:\cmsynergy\jdoe";
            connection.ClientDatabaseDirectory = @"C:\cmsynergy\uidb";
            connection.SessionId               = "LOCALHOST:1234:127.0.0.1";
            project = synergy.Project;
            project.ProjectSpecification = "MyProject-MyProject_Int";
            project.ObjectName           = "MyProject-MyProject_Int:project:1";
            project.Purpose    = "Integration Testing";
            project.Release    = "MyProduct/1.0";
            project.TaskFolder = 1234;
        }
        public void ApplyLabel()
        {
            IMock mockCommand = new DynamicMock(typeof(ISynergyCommand));

            mockCommand.ExpectAndReturn("Execute", ProcessResultFixture.CreateSuccessfulResult(DateTime.MinValue.ToString(CultureInfo.InvariantCulture)), new IsAnything());
            mockCommand.ExpectAndReturn("Execute", ProcessResultFixture.CreateSuccessfulResult("output"), new IsAnything());
            mockCommand.ExpectAndReturn("Execute", ProcessResultFixture.CreateSuccessfulResult("output"), new IsAnything(), false);
            mockCommand.ExpectAndReturn("Execute", ProcessResultFixture.CreateSuccessfulResult("output"), new IsAnything(), false);
            mockCommand.ExpectAndReturn("Execute", ProcessResultFixture.CreateSuccessfulResult("output"), new IsAnything(), false);
            IMock mockParser = new DynamicMock(typeof(SynergyParser));

            mockParser.ExpectAndReturn("Parse", new Modification[0], new IsAnything(), new IsAnything(), new NotNull());

            SynergyConnectionInfo connectionInfo = new SynergyConnectionInfo();

            connectionInfo.FormatProvider = CultureInfo.InvariantCulture;
            Synergy           synergy           = new Synergy(connectionInfo, new SynergyProjectInfo(), (ISynergyCommand)mockCommand.MockInstance, (SynergyParser)mockParser.MockInstance);
            IntegrationResult integrationResult = new IntegrationResult();

            integrationResult.Status = ThoughtWorks.CruiseControl.Remote.IntegrationStatus.Success;
            synergy.LabelSourceControl(integrationResult);
            mockCommand.Verify();
        }
        public void ApplyLabel()
        {
            var          mockCommand = new Mock <ISynergyCommand>();
            MockSequence sequence    = new MockSequence();

            mockCommand.InSequence(sequence).Setup(command => command.Execute(It.IsAny <ProcessInfo>())).Returns(ProcessResultFixture.CreateSuccessfulResult(DateTime.MinValue.ToString(CultureInfo.InvariantCulture))).Verifiable();
            mockCommand.InSequence(sequence).Setup(command => command.Execute(It.IsAny <ProcessInfo>())).Returns(ProcessResultFixture.CreateSuccessfulResult("output")).Verifiable();
            mockCommand.InSequence(sequence).Setup(command => command.Execute(It.IsAny <ProcessInfo>(), false)).Returns(ProcessResultFixture.CreateSuccessfulResult("output")).Verifiable();
            mockCommand.InSequence(sequence).Setup(command => command.Execute(It.IsAny <ProcessInfo>(), false)).Returns(ProcessResultFixture.CreateSuccessfulResult("output")).Verifiable();
            mockCommand.InSequence(sequence).Setup(command => command.Execute(It.IsAny <ProcessInfo>(), false)).Returns(ProcessResultFixture.CreateSuccessfulResult("output")).Verifiable();
            var mockParser = new Mock <SynergyParser>();

            mockParser.Setup(parser => parser.Parse(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>())).Returns(new Modification[0]).Verifiable();

            SynergyConnectionInfo connectionInfo = new SynergyConnectionInfo();

            connectionInfo.FormatProvider = CultureInfo.InvariantCulture;
            Synergy           synergy           = new Synergy(connectionInfo, new SynergyProjectInfo(), (ISynergyCommand)mockCommand.Object, (SynergyParser)mockParser.Object);
            IntegrationResult integrationResult = new IntegrationResult();

            integrationResult.Status = ThoughtWorks.CruiseControl.Remote.IntegrationStatus.Success;
            synergy.LabelSourceControl(integrationResult);
            mockCommand.Verify();
        }