public void GetModificationsForModificationInRootFolder() { sandboxRoot = TempFileUtil.GetTempPath("MksSandBox"); Modification addedModification = ModificationMother.CreateModification("myFile.file", null); addedModification.Type = "Added"; mksHistoryParserWrapper.Setup(parser => parser.Parse(It.IsAny <TextReader>(), FROM, TO)).Returns(new Modification[] { addedModification }).Verifiable(); mksHistoryParserWrapper.Setup(parser => parser.ParseMemberInfoAndAddToModification(It.IsAny <Modification>(), It.IsAny <StringReader>())).Verifiable(); mockExecutorWrapper.Setup(executor => executor.Execute(It.IsAny <ProcessInfo>())).Returns(new ProcessResult("", null, 0, false)).Verifiable(); string expectedCommand = string.Format(@"memberinfo --xmlapi --user=CCNetUser --password=CCNetPassword --quiet {0}", GeneratePath(@"{0}\myFile.file", sandboxRoot)); ProcessInfo expectedProcessInfo = ExpectedProcessInfo(expectedCommand); mockExecutorWrapper.Setup(executor => executor.Execute(expectedProcessInfo)).Returns(new ProcessResult(null, null, 0, false)).Verifiable(); string expectedDisconnectCommand = string.Format(@"disconnect --user=CCNetUser --password=CCNetPassword --quiet --forceConfirm=yes"); ProcessInfo expectedDisconnectProcessInfo = ExpectedProcessInfo(expectedDisconnectCommand); mockExecutorWrapper.Setup(executor => executor.Execute(expectedDisconnectProcessInfo)).Returns(new ProcessResult(null, null, 0, false)).Verifiable(); mks = CreateMks(CreateSourceControlXml(), mksHistoryParser, mockProcessExecutor); Modification[] modifications = mks.GetModifications(IntegrationResultMother.CreateSuccessful(FROM), IntegrationResultMother.CreateSuccessful(TO)); Assert.AreEqual(1, modifications.Length); }
public void GetModificationsCallsParseMemberInfo() { Modification addedModification = ModificationMother.CreateModification("myFile.file", "MyFolder"); addedModification.Type = "Added"; mksHistoryParserWrapper.ExpectAndReturn("Parse", new Modification[] { addedModification }, new IsTypeOf(typeof(TextReader)), FROM, TO); mksHistoryParserWrapper.ExpectAndReturn("ParseMemberInfoAndAddToModification", new Modification[] { addedModification }, new IsTypeOf(typeof(Modification)), new IsTypeOf(typeof(StringReader))); mockExecutorWrapper.ExpectAndReturn("Execute", new ProcessResult("", null, 0, false), new IsTypeOf(typeof(ProcessInfo))); string expectedCommand = string.Format(@"memberinfo --xmlapi --user=CCNetUser --password=CCNetPassword --quiet {0}", GeneratePath(@"{0}\MyFolder\myFile.file", sandboxRoot)); ProcessInfo expectedProcessInfo = ExpectedProcessInfo(expectedCommand); mockExecutorWrapper.ExpectAndReturn("Execute", new ProcessResult(null, null, 0, false), expectedProcessInfo); string expectedDisconnectCommand = string.Format(@"disconnect --user=CCNetUser --password=CCNetPassword --quiet --forceConfirm=yes"); ProcessInfo expectedDisconnectProcessInfo = ExpectedProcessInfo(expectedDisconnectCommand); mockExecutorWrapper.ExpectAndReturn("Execute", new ProcessResult(null, null, 0, false), expectedDisconnectProcessInfo); mks = CreateMks(CreateSourceControlXml(), mksHistoryParser, mockProcessExecutor); Modification[] modifications = mks.GetModifications(IntegrationResultMother.CreateSuccessful(FROM), IntegrationResultMother.CreateSuccessful(TO)); Assert.AreEqual(1, modifications.Length); }
public void CaseSensitivityTest() { Modification m = ModificationMother.CreateModification("x.xml", "/working/sources"); PathFilter filter = new PathFilter(); filter.Pattern = "**/*.xml"; Assert.IsTrue(filter.Accept(m)); m.FileName = "test.Xml"; Assert.IsFalse(filter.Accept(m)); filter.CaseSensitive = false; Assert.IsTrue(filter.Accept(m)); }
public void DeeplyNestedFilters() { Modification[] modlist = new Modification[] { ModificationMother.CreateModification("x.cs", "/working/sources"), ModificationMother.CreateModification("Entries", "/working/sources/CVS"), ModificationMother.CreateModification("x.build", "/working/build"), ModificationMother.CreateModification("x.dll", "/working/build/target/sources") }; PathFilter filter = new PathFilter(); filter.Pattern = "**/sources/**/*.*"; filter.Accept(modlist[0]); }
public void GetModificationsFiltersByModifiedTimeIfCheckpointOnSuccessIsFalse() { Modification modificationBeforePreviousIntegration = ModificationMother.CreateModification("ccnet", FROM.AddMinutes(-2)); Modification modificationInThisIntegration = ModificationMother.CreateModification("ccnet", TO.AddMinutes(-1)); Modification modificationAfterIntegrationStartTime = ModificationMother.CreateModification("myFile.file", TO.AddMinutes(1)); Modification[] integrationModifications = new Modification[] { modificationBeforePreviousIntegration, modificationInThisIntegration, modificationAfterIntegrationStartTime }; mksHistoryParserWrapper.Setup(parser => parser.Parse(It.IsAny <TextReader>(), FROM, TO)).Returns(integrationModifications).Verifiable(); mksHistoryParserWrapper.Setup(parser => parser.ParseMemberInfoAndAddToModification(modificationBeforePreviousIntegration, It.IsAny <StringReader>())).Verifiable(); mksHistoryParserWrapper.Setup(parser => parser.ParseMemberInfoAndAddToModification(modificationInThisIntegration, It.IsAny <StringReader>())).Verifiable(); mksHistoryParserWrapper.Setup(parser => parser.ParseMemberInfoAndAddToModification(modificationAfterIntegrationStartTime, It.IsAny <StringReader>())).Verifiable(); mockExecutorWrapper.Setup(executor => executor.Execute(It.IsAny <ProcessInfo>())).Returns(new ProcessResult("", null, 0, false)).Verifiable(); mks = CreateMks(CreateSourceControlXml(), mksHistoryParser, mockProcessExecutor); mks.CheckpointOnSuccess = false; Modification[] modifications = mks.GetModifications(IntegrationResultMother.CreateSuccessful(FROM), IntegrationResultMother.CreateSuccessful(TO)); Assert.AreEqual(1, modifications.Length); }
public void GetModificationsFiltersByModifiedTimeIfCheckpointOnSuccessIsFalse() { Modification modificationBeforePreviousIntegration = ModificationMother.CreateModification("ccnet", FROM.AddMinutes(-2)); Modification modificationInThisIntegration = ModificationMother.CreateModification("ccnet", TO.AddMinutes(-1)); Modification modificationAfterIntegrationStartTime = ModificationMother.CreateModification("myFile.file", TO.AddMinutes(1)); Modification[] integrationModifications = new Modification[] { modificationBeforePreviousIntegration, modificationInThisIntegration, modificationAfterIntegrationStartTime }; mksHistoryParserWrapper.ExpectAndReturn("Parse", integrationModifications, new IsTypeOf(typeof(TextReader)), FROM, TO); mksHistoryParserWrapper.ExpectAndReturn("ParseMemberInfoAndAddToModification", null, modificationBeforePreviousIntegration, new IsTypeOf(typeof(StringReader))); mksHistoryParserWrapper.ExpectAndReturn("ParseMemberInfoAndAddToModification", null, modificationInThisIntegration, new IsTypeOf(typeof(StringReader))); mksHistoryParserWrapper.ExpectAndReturn("ParseMemberInfoAndAddToModification", null, modificationAfterIntegrationStartTime, new IsTypeOf(typeof(StringReader))); mockExecutorWrapper.SetupResult("Execute", new ProcessResult("", null, 0, false), new Type[] { typeof(ProcessInfo) }); mks = CreateMks(CreateSourceControlXml(), mksHistoryParser, mockProcessExecutor); mks.CheckpointOnSuccess = false; Modification[] modifications = mks.GetModifications(IntegrationResultMother.CreateSuccessful(FROM), IntegrationResultMother.CreateSuccessful(TO)); Assert.AreEqual(1, modifications.Length); }
public void GetModificationsCallsMemberInfoForNonDeletedModifications() { Modification addedModification = ModificationMother.CreateModification("myFile.file", "MyFolder"); addedModification.Type = "Added"; Modification modifiedModification = ModificationMother.CreateModification("myFile.file", "MyFolder"); modifiedModification.Type = "Modified"; Modification deletedModification = ModificationMother.CreateModification("myFile.file", "MyFolder"); deletedModification.Type = "Deleted"; mksHistoryParserWrapper.Setup(parser => parser.Parse(It.IsAny <TextReader>(), FROM, TO)).Returns(new Modification[] { addedModification, modifiedModification, deletedModification }).Verifiable(); mksHistoryParserWrapper.Setup(parser => parser.ParseMemberInfoAndAddToModification(addedModification, It.IsAny <StringReader>())).Verifiable(); mksHistoryParserWrapper.Setup(parser => parser.ParseMemberInfoAndAddToModification(modifiedModification, It.IsAny <StringReader>())).Verifiable(); mksHistoryParserWrapper.Setup(parser => parser.ParseMemberInfoAndAddToModification(deletedModification, It.IsAny <StringReader>())).Verifiable(); mockExecutorWrapper.Setup(executor => executor.Execute(It.IsAny <ProcessInfo>())).Returns(new ProcessResult("", null, 0, false)).Verifiable(); mks = CreateMks(CreateSourceControlXml(), mksHistoryParser, mockProcessExecutor); Modification[] modifications = mks.GetModifications(IntegrationResultMother.CreateSuccessful(FROM), IntegrationResultMother.CreateSuccessful(TO)); Assert.AreEqual(3, modifications.Length); }
public void GetModificationsCallsMemberInfoForNonDeletedModifications() { Modification addedModification = ModificationMother.CreateModification("myFile.file", "MyFolder"); addedModification.Type = "Added"; Modification modifiedModification = ModificationMother.CreateModification("myFile.file", "MyFolder"); modifiedModification.Type = "Modified"; Modification deletedModification = ModificationMother.CreateModification("myFile.file", "MyFolder"); deletedModification.Type = "Deleted"; mksHistoryParserWrapper.ExpectAndReturn("Parse", new Modification[] { addedModification, modifiedModification, deletedModification }, new IsTypeOf(typeof(TextReader)), FROM, TO); mksHistoryParserWrapper.ExpectAndReturn("ParseMemberInfoAndAddToModification", null, addedModification, new IsTypeOf(typeof(StringReader))); mksHistoryParserWrapper.ExpectAndReturn("ParseMemberInfoAndAddToModification", null, modifiedModification, new IsTypeOf(typeof(StringReader))); mksHistoryParserWrapper.ExpectAndReturn("ParseMemberInfoAndAddToModification", null, deletedModification, new IsTypeOf(typeof(StringReader))); mockExecutorWrapper.SetupResult("Execute", new ProcessResult("", null, 0, false), new Type[] { typeof(ProcessInfo) }); mks = CreateMks(CreateSourceControlXml(), mksHistoryParser, mockProcessExecutor); Modification[] modifications = mks.GetModifications(IntegrationResultMother.CreateSuccessful(FROM), IntegrationResultMother.CreateSuccessful(TO)); Assert.AreEqual(3, modifications.Length); }