public void Error_CloneHasHigherModelVersion() { // Setup var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath; MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath); MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, LcmCache.ModelVersion); MercurialTestHelper.CreateFlexRepo(lDProjectFolderPath); MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, 7600000); MercurialTestHelper.HgCommit(lDProjectFolderPath, "on branch"); // Execute _EnsureCloneAction.Run(_lfProject); // Verify Assert.That(_env.Logger.GetErrors(), Does.Contain("clone has higher model")); Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.ERROR)); Assert.That(ModelVersion, Is.EqualTo(0)); Assert.That(Directory.Exists(_lfProject.ProjectDir), Is.False); }
public void Error_NotAFlexProject() { // Setup // Create a non-FLEx hg repo (in this case an empty repo) var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath; MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath); File.WriteAllText(Path.Combine(lDProjectFolderPath, "some.file"), "just a test file"); MercurialTestHelper.HgCommit(lDProjectFolderPath, "Initial commit"); // Execute _EnsureCloneAction.Run(_lfProject); // Verify Assert.That(_env.Logger.GetErrors(), Does.Contain("clone is not a FLEx project")); Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.ERROR)); Assert.That(ModelVersion, Is.EqualTo(0)); Assert.That(Directory.Exists(_lfProject.ProjectDir), Is.False); }
public void Error_NewerBranch() { // Setup var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath; MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath); MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, LcmCache.ModelVersion); MercurialTestHelper.CreateFlexRepo(lDProjectFolderPath); MercurialTestHelper.CloneRepo(lDProjectFolderPath, _lfProject.ProjectDir); // Simulate a user with a newer FLEx version doing a S/R MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, 7600000); MercurialTestHelper.HgCommit(lDProjectFolderPath, "Commit with newer FLEx version"); LanguageDepotMock.Server.Start(); // Execute _synchronizeAction.Run(_lfProject); // Verify Assert.That(_env.Logger.GetMessages(), Does.Contain("Allow data migration for project")); Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.SYNCING)); }
public void Success_Update() { // Setup var lDProjectFolderPath = LanguageDepotMock.ProjectFolderPath; MercurialTestHelper.InitializeHgRepo(lDProjectFolderPath); MercurialTestHelper.CreateFlexRepo(lDProjectFolderPath); MercurialTestHelper.HgCreateBranch(lDProjectFolderPath, LcmCache.ModelVersion); MercurialTestHelper.HgCommit(lDProjectFolderPath, "on branch"); // Execute _EnsureCloneAction.Run(_lfProject); // Verify Assert.That(_env.Logger.GetErrors(), Is.Empty); Assert.That(_lfProject.State.SRState, Is.EqualTo(ProcessingState.SendReceiveStates.CLONED)); Assert.That(MercurialTestHelper.GetUsernameFromHgrc(_lfProject.ProjectDir), Is.EqualTo("Language Forge")); Assert.That(ModelVersion, Is.EqualTo(LcmCache.ModelVersion)); Assert.That(Directory.Exists(_lfProject.ProjectDir), Is.True); }