public void GetModifications()
        {
            mockExecutor.ExpectAndReturn("Execute", ProcessResultFixture.CreateSuccessfulResult(), new IsAnything());
            mockParser.ExpectAndReturn("Parse", new Modification[] { new Modification(), new Modification() }, new IsAnything(), new IsAnything(), new IsAnything());

            Modification[] mods = pvcs.GetModifications(IntegrationResultMother.CreateSuccessful(new DateTime(2004, 6, 1, 1, 1, 1)),
                                                        IntegrationResultMother.CreateSuccessful(new DateTime(2004, 6, 1, 2, 2, 2)));
            Assert.AreEqual(2, mods.Length);
        }
        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 GetModifications()
        {
            IMock mockCommand = new DynamicMock(typeof(ISynergyCommand));

            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());

            Synergy synergy = new Synergy(new SynergyConnectionInfo(), new SynergyProjectInfo(), (ISynergyCommand)mockCommand.MockInstance, (SynergyParser)mockParser.MockInstance);

            synergy.GetModifications(new IntegrationResult(), new IntegrationResult());
            mockCommand.Verify();
        }
        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();
        }
Exemple #5
0
        public void ShouldHandleSpecialCharacters()
        {
            DevenvTaskResult result = new DevenvTaskResult(ProcessResultFixture.CreateSuccessfulResult("<T>"), null);

            Assert.AreEqual("<buildresults><message>&lt;T&gt;</message></buildresults>", result.Data);
        }
        public void CheckIfSuccessIfProcessResultSucceeded()
        {
            ProcessTaskResult result = new ProcessTaskResult(ProcessResultFixture.CreateSuccessfulResult());

            Assert.IsTrue(result.CheckIfSuccess());
        }
        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();
        }
        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();
        }
        public void GetModifications()
        {
            var          mockCommand = new Mock <ISynergyCommand>();
            MockSequence sequence    = new MockSequence();

            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();

            Synergy synergy = new Synergy(new SynergyConnectionInfo(), new SynergyProjectInfo(), (ISynergyCommand)mockCommand.Object, (SynergyParser)mockParser.Object);

            synergy.GetModifications(new IntegrationResult(), new IntegrationResult());
            mockCommand.Verify();
        }
        public void GetModifications()
        {
            mockExecutor.Setup(executor => executor.Execute(It.IsAny <ProcessInfo>())).Returns(ProcessResultFixture.CreateSuccessfulResult()).Verifiable();
            mockParser.Setup(parser => parser.Parse(It.IsAny <TextReader>(), It.IsAny <DateTime>(), It.IsAny <DateTime>())).Returns(new Modification[] { new Modification(), new Modification() }).Verifiable();

            Modification[] mods = pvcs.GetModifications(IntegrationResultMother.CreateSuccessful(new DateTime(2004, 6, 1, 1, 1, 1)),
                                                        IntegrationResultMother.CreateSuccessful(new DateTime(2004, 6, 1, 2, 2, 2)));
            Assert.AreEqual(2, mods.Length);
        }