From 39fc6cfc8cb602bd9181f7df6cdbb775aa48580c Mon Sep 17 00:00:00 2001 From: Peter Baumann Date: Wed, 3 Nov 2021 19:56:10 +0100 Subject: [PATCH] IGitTfsRemote: remove setter for property TfsRepositoryPath The setter is not used and during the lifetime of the object the property value shouldn't be changed. Remove it. --- src/GitTfs/Core/DerivedGitTfsRemote.cs | 1 - src/GitTfs/Core/GitTfsRemote.cs | 2 +- src/GitTfs/Core/IGitTfsRemote.cs | 2 +- src/GitTfsTest/Commands/InitBranchTest.cs | 6 +++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/GitTfs/Core/DerivedGitTfsRemote.cs b/src/GitTfs/Core/DerivedGitTfsRemote.cs index 7dd0d3fd..25d4e42a 100644 --- a/src/GitTfs/Core/DerivedGitTfsRemote.cs +++ b/src/GitTfs/Core/DerivedGitTfsRemote.cs @@ -74,7 +74,6 @@ namespace GitTfs.Core public string TfsRepositoryPath { get { return _tfsRepositoryPath; } - set { throw DerivedRemoteException; } } public string[] TfsSubtreePaths diff --git a/src/GitTfs/Core/GitTfsRemote.cs b/src/GitTfs/Core/GitTfsRemote.cs index 289a728d..0c997a10 100644 --- a/src/GitTfs/Core/GitTfsRemote.cs +++ b/src/GitTfs/Core/GitTfsRemote.cs @@ -133,7 +133,7 @@ namespace GitTfs.Core set { Tfs.Password = value; } } - public string TfsRepositoryPath { get; set; } + public string TfsRepositoryPath { get; } /// /// Gets the TFS server-side paths of all subtrees of this remote. diff --git a/src/GitTfs/Core/IGitTfsRemote.cs b/src/GitTfs/Core/IGitTfsRemote.cs index 2ec37cd9..a7b4380b 100644 --- a/src/GitTfs/Core/IGitTfsRemote.cs +++ b/src/GitTfs/Core/IGitTfsRemote.cs @@ -32,7 +32,7 @@ namespace GitTfs.Core RemoteInfo RemoteInfo { get; } string Id { get; } string TfsUrl { get; set; } - string TfsRepositoryPath { get; set; } + string TfsRepositoryPath { get; } /// /// Gets the TFS server-side paths of all subtrees of this remote. /// Valid if the remote has subtrees, which occurs when is null. diff --git a/src/GitTfsTest/Commands/InitBranchTest.cs b/src/GitTfsTest/Commands/InitBranchTest.cs index 18da3d80..09bdb306 100644 --- a/src/GitTfsTest/Commands/InitBranchTest.cs +++ b/src/GitTfsTest/Commands/InitBranchTest.cs @@ -44,7 +44,7 @@ namespace GitTfs.Test.Commands var trunkGitTfsRemote = trunkGitTfsRemoteMock.Object; trunkGitTfsRemote.TfsUsername = "user"; trunkGitTfsRemote.TfsPassword = "pwd"; - trunkGitTfsRemote.TfsRepositoryPath = "$/MyProject/Trunk"; + trunkGitTfsRemoteMock.SetupGet(x => x.TfsRepositoryPath).Returns("$/MyProject/Trunk"); trunkGitTfsRemote.TfsUrl = "http://myTfsServer:8080/tfs"; newBranchRemoteMock = Mock.Get(mocks.Get()).SetupAllProperties(); @@ -115,7 +115,7 @@ namespace GitTfs.Test.Commands IGitTfsRemote existingBranchRemote = gitTfsRemoteMock.Object; existingBranchRemote.TfsUsername = "user"; existingBranchRemote.TfsPassword = "pwd"; - existingBranchRemote.TfsRepositoryPath = "$/MyProject/MyBranch"; + gitTfsRemoteMock.SetupGet(x => x.TfsRepositoryPath).Returns("$/MyProject/MyBranch"); existingBranchRemote.TfsUrl = "http://myTfsServer:8080/tfs"; gitRepository.Name = nameof(gitRepository); @@ -366,7 +366,7 @@ namespace GitTfs.Test.Commands var remote = remoteMock.Object; remote.TfsUsername = "user"; remote.TfsPassword = "pwd"; - remote.TfsRepositoryPath = "$/MyProject/Trunk"; + remoteMock.SetupGet(x => x.TfsRepositoryPath).Returns("$/MyProject/Trunk"); remote.TfsUrl = "http://myTfsServer:8080/tfs"; remoteMock.SetupGet(x => x.Tfs).Returns(new TfsHelper(mocks.Container, null));