public void TestFetchArguments() { // TODO produce a valid working directory var module = new VsrModule(Path.GetTempPath()); { // Specifying a remote and a local branch creates a local branch var fetchCmd = module.FetchCmd("origin", "some-branch", "local").Arguments; Assert.AreEqual("fetch --progress \"origin\" +some-branch:refs/heads/local --no-tags", fetchCmd); } { var fetchCmd = module.FetchCmd("origin", "some-branch", "local", true).Arguments; Assert.AreEqual("fetch --progress \"origin\" +some-branch:refs/heads/local --tags", fetchCmd); } { // Using a URL as remote and passing a local branch creates the branch var fetchCmd = module.FetchCmd("https://host.com/repo", "some-branch", "local").Arguments; Assert.AreEqual("fetch --progress \"https://host.com/repo\" +some-branch:refs/heads/local --no-tags", fetchCmd); } { // Using a URL as remote and not passing a local branch var fetchCmd = module.FetchCmd("https://host.com/repo", "some-branch", null).Arguments; Assert.AreEqual("fetch --progress \"https://host.com/repo\" +some-branch --no-tags", fetchCmd); } { // No remote branch -> No local branch var fetchCmd = module.FetchCmd("origin", "", "local").Arguments; Assert.AreEqual("fetch --progress \"origin\" --no-tags", fetchCmd); } { // Pull doesn't accept a local branch ever var fetchCmd = module.PullCmd("origin", "some-branch", false).Arguments; Assert.AreEqual("pull --progress \"origin\" +some-branch --no-tags", fetchCmd); } { // Not even for URL remote var fetchCmd = module.PullCmd("https://host.com/repo", "some-branch", false).Arguments; Assert.AreEqual("pull --progress \"https://host.com/repo\" +some-branch --no-tags", fetchCmd); } { // Pull with rebase var fetchCmd = module.PullCmd("origin", "some-branch", true).Arguments; Assert.AreEqual("pull --rebase --progress \"origin\" +some-branch --no-tags", fetchCmd); } }