Exemplo n.º 1
0
		public void ShouldNotGetSourceIfAutoGetSourceFalse()
		{
			DynamicMock executor = new DynamicMock(typeof(ProcessExecutor));
			AccuRev accurev = new AccuRev((ProcessExecutor) executor.MockInstance);
			accurev.AutoGetSource = false;

			executor.ExpectNoCall("Execute", typeof(ProcessInfo));
			accurev.GetSource(new IntegrationResult());
			executor.Verify();
		}
Exemplo n.º 2
0
        public void CanCatchConfigInvalidLabelOnSuccess()
        {
            AccuRev accurev = new AccuRev();
            const string invalidXml =
@"<sourcecontrol type=""accurev"">
    <labelOnSuccess>NOT_A_BOOLEAN</labelOnSuccess>
</sourcecontrol>";
            Assert.That(delegate { NetReflector.Read(invalidXml, accurev); },
                        Throws.TypeOf<NetReflectorConverterException>());
        }
Exemplo n.º 3
0
		public void ShouldGetSourceIfAutoGetSourceTrue()
		{
			DynamicMock executor = new DynamicMock(typeof(ProcessExecutor));
			AccuRev accurev = new AccuRev((ProcessExecutor) executor.MockInstance);
			accurev.AutoGetSource = true;

			ProcessInfo expectedProcessRequest = new ProcessInfo("accurev.exe", "update");
			expectedProcessRequest.TimeOut = Timeout.DefaultTimeout.Millis;

			executor.ExpectAndReturn("Execute", new ProcessResult("foo", null, 0, false), expectedProcessRequest);
			accurev.GetSource(new IntegrationResult());
			executor.Verify();
		}
Exemplo n.º 4
0
		public void ShouldPopulateCorrectlyFromXml()
		{
			const string AccuRev_XML =
@"<sourceControl type=""accuRev"">
    <autoGetSource>false</autoGetSource>
    <executable>accurev.exe</executable>
    <labelOnSuccess>true</labelOnSuccess>
    <workspace>C:\DOES NOT\EXIST</workspace>
</sourceControl>";
			
			AccuRev accurev = new AccuRev();
			NetReflector.Read(AccuRev_XML, accurev);
			Assert.AreEqual(false, accurev.AutoGetSource);
			Assert.AreEqual("accurev.exe", accurev.Executable);
			Assert.AreEqual(true, accurev.LabelOnSuccess);
			Assert.AreEqual(@"C:\DOES NOT\EXIST", accurev.Workspace);
		}
Exemplo n.º 5
0
        public void ShouldUpdateSourceToHighestKnownModification()
        {
            DynamicMock executor = new DynamicMock(typeof(ProcessExecutor));
            AccuRev accurev = new AccuRev((ProcessExecutor)executor.MockInstance);
            accurev.AutoGetSource = true;

            ProcessInfo expectedProcessRequest = new ProcessInfo("accurev.exe", "update -t 10");
            expectedProcessRequest.TimeOut = Timeout.DefaultTimeout.Millis;

            executor.ExpectAndReturn("Execute", new ProcessResult("foo", null, 0, false), expectedProcessRequest);
            IntegrationResult result = new IntegrationResult();
            result.Modifications = new Modification[2];
            result.Modifications[0] = new Modification
            {
                ChangeNumber = "5",
                ModifiedTime = new DateTime(2009, 1, 1)
            };
            result.Modifications[1] = new Modification
            {
                ChangeNumber = "10",
                ModifiedTime = new DateTime(2009, 1, 2)
            };
            accurev.mods = result.Modifications;

            accurev.GetSource(result);
            executor.Verify();
        }
Exemplo n.º 6
0
        public void ShouldUpdateSourceToCurrentIfNoModifications()
        {
            DynamicMock executor = new DynamicMock(typeof(ProcessExecutor));
            AccuRev accurev = new AccuRev((ProcessExecutor)executor.MockInstance);
            accurev.AutoGetSource = true;

            ProcessInfo expectedProcessRequest = new ProcessInfo("accurev.exe", "update");  // Note: No "-t whatever"
            expectedProcessRequest.TimeOut = Timeout.DefaultTimeout.Millis;

            executor.ExpectAndReturn("Execute", new ProcessResult("foo", null, 0, false), expectedProcessRequest);
            IntegrationResult result = new IntegrationResult();
            accurev.GetSource(result);
            executor.Verify();
        }