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