public void EnsureTheseExtensionAreEnabled_noExistingExtensions_AddsThem() { using (new MercurialIniForTests()) using (var setup = new RepositorySetup("Dan")) { setup.EnsureNoHgrcExists(); var extensions = new Dictionary<string, string>(); extensions.Add("a",""); extensions.Add("b", ""); setup.Repository.EnsureTheseExtensionsAndFormatSet(extensions); Assert.AreEqual("a", setup.Repository.GetEnabledExtension().First()); Assert.AreEqual("b", setup.Repository.GetEnabledExtension().ToArray()[1]); } }
public void SetUserNameInIni_SetsName() { using (new MercurialIniForTests()) using (var setup = new RepositorySetup("Dan")) { setup.EnsureNoHgrcExists(); var repository = setup.CreateSynchronizer().Repository; repository.SetUserNameInIni("bill", _progress); Assert.AreEqual("bill", repository.GetUserNameFromIni(_progress, "anonymous")); //this time, the hgrc does exist repository.SetUserNameInIni("sue", _progress); Assert.AreEqual("sue", repository.GetUserNameFromIni(_progress, "anonymous")); } }
public void SetTheOnlyAddressOfThisType_SettingLANPathHadSameType_IsReplacedByNew() { using (new MercurialIniForTests()) using (var setup = new RepositorySetup("Dan")) { setup.EnsureNoHgrcExists(); var repository = setup.CreateSynchronizer().Repository; var x = RepositoryAddress.Create("theInterent", @"http://two.org"); var y1 = RepositoryAddress.Create("aPath1", @"\\someone1\someFolder"); repository.SetKnownRepositoryAddresses(new List<RepositoryAddress>(new RepositoryAddress[] { x, y1 })); Assert.AreEqual(y1.URI, repository.GetRepositoryPathsInHgrc().ToArray()[1].URI, "Test setup is wrong"); var y2 = RepositoryAddress.Create("aPath2", @"\\someoneElse2\someOtherFolder"); repository.SetTheOnlyAddressOfThisType(y2); Assert.AreEqual(2, repository.GetRepositoryPathsInHgrc().Count()); AssertHgrcNowContainsUri(repository, x.URI); AssertHgrcNowContainsUri(repository, y2.URI); } }
public void SetTheOnlyAddressOfThisType_WasEmtpy_HasNewAddress() { using (new MercurialIniForTests()) using (var setup = new RepositorySetup("Dan")) { setup.EnsureNoHgrcExists(); var repository = setup.CreateSynchronizer().Repository; var y1 = RepositoryAddress.Create("aPath1", @"\\someone1\someFolder"); repository.SetTheOnlyAddressOfThisType(y1); Assert.AreEqual(1, repository.GetRepositoryPathsInHgrc().Count()); Assert.AreEqual(y1.URI, repository.GetRepositoryPathsInHgrc().ToArray()[0].URI); } }
public void SetTheOnlyAddressOfThisType_SettingInternetPathHadSameType_IsReplacedByNew() { using (new MercurialIniForTests()) using (var setup = new RepositorySetup("Dan")) { setup.EnsureNoHgrcExists(); var repository = setup.CreateSynchronizer().Repository; var x1 = RepositoryAddress.Create("interent1", @"http://one.org"); var y = RepositoryAddress.Create("aPath", @"\\someone1\someFolder"); repository.SetKnownRepositoryAddresses(new List<RepositoryAddress>(new RepositoryAddress[] { x1, y })); Assert.AreEqual(x1.URI, repository.GetRepositoryPathsInHgrc().ToArray()[0].URI, "Test setup is wrong"); var x2 = RepositoryAddress.Create("internet2", @"http://two.org"); repository.SetTheOnlyAddressOfThisType(x2); Assert.AreEqual(2, repository.GetRepositoryPathsInHgrc().Count()); AssertHgrcNowContainsUri(repository, y.URI); AssertHgrcNowContainsUri(repository, x2.URI); } }
public void SetTheOnlyAddressOfThisType_HadAnotherType_HasOldAddressAndNew() { using (new MercurialIniForTests()) using (var setup = new RepositorySetup("Dan")) { setup.EnsureNoHgrcExists(); var repository = setup.CreateSynchronizer().Repository; var x = RepositoryAddress.Create("theInterent", @"http://two.org"); repository.SetKnownRepositoryAddresses(new List<RepositoryAddress>(new RepositoryAddress[] { x })); var y2 = RepositoryAddress.Create("aPath2", @"\\someoneElse2\someOtherFolder"); repository.SetTheOnlyAddressOfThisType(y2); Assert.AreEqual(2, repository.GetRepositoryPathsInHgrc().Count()); AssertHgrcNowContainsUri(repository, x.URI); AssertHgrcNowContainsUri(repository, y2.URI); } }
public void SetRepositoryAliases() { using (new MercurialIniForTests()) using (var setup = new RepositorySetup("Dan")) { setup.EnsureNoHgrcExists(); var repository = setup.CreateSynchronizer().Repository; var x = RepositoryAddress.Create("one", @"c:\one"); var y = RepositoryAddress.Create("two", @"http://two.org"); repository.SetKnownRepositoryAddresses(new List<RepositoryAddress>(new RepositoryAddress[]{x,y})); Assert.AreEqual(2, repository.GetRepositoryPathsInHgrc().Count()); Assert.AreEqual(x.Name, repository.GetRepositoryPathsInHgrc().First().Name); Assert.AreEqual(x.URI, repository.GetRepositoryPathsInHgrc().First().URI); Assert.AreEqual(y.Name, repository.GetRepositoryPathsInHgrc().ToArray()[1].Name); Assert.AreEqual(y.URI, repository.GetRepositoryPathsInHgrc().ToArray()[1].URI); var z = RepositoryAddress.Create("three", @"http://three.org"); //this time, the hgrc does exist repository.SetKnownRepositoryAddresses(new List<RepositoryAddress>(new RepositoryAddress[]{z})); Assert.AreEqual(1, repository.GetRepositoryPathsInHgrc().Count()); Assert.AreEqual(z.Name, repository.GetRepositoryPathsInHgrc().First().Name); Assert.AreEqual(z.URI, repository.GetRepositoryPathsInHgrc().First().URI); } }
public void SetAndGetDefaultSyncRepositories() { using (new MercurialIniForTests()) using (var setup = new RepositorySetup("Dan")) { setup.EnsureNoHgrcExists(); var repository = setup.CreateSynchronizer().Repository; var x = RepositoryAddress.Create("one", @"c:\one"); var y = RepositoryAddress.Create("two", @"http://two.org"); var z = RepositoryAddress.Create("three", @"http://three.org"); repository.SetKnownRepositoryAddresses(new List<RepositoryAddress>(new RepositoryAddress[] { x, y,z })); repository.SetDefaultSyncRepositoryAliases(new string[] {"one", "three"}); Assert.AreEqual(2, repository.GetDefaultSyncAliases().Count()); repository.SetDefaultSyncRepositoryAliases(new string[] { "two" }); Assert.AreEqual(1, repository.GetDefaultSyncAliases().Count()); } }
public void GetUserName_NoHgrcYet_ReturnsDefault() { using (new MercurialIniForTests()) using (var setup = new RepositorySetup("Dan")) { setup.EnsureNoHgrcExists(); var repository = setup.CreateSynchronizer().Repository; Assert.AreEqual("anonymous", repository.GetUserNameFromIni(_progress, "anonymous")); } }