public void TestIsNotControlledSelection() { try { PlasticApiMock apiMock = new PlasticApiMock(); Plastic.InitializeAPIForTesting(apiMock); string fooPath = Path.Combine(Path.GetTempPath(), "foo.c"); string barPath = Path.Combine(Path.GetTempPath(), "bar.c"); Asset fooAsset = new Asset(fooPath); Asset barAsset = new Asset(barPath); WorkspaceTreeNode fooNode = BuildWorkspaceTreeNode.Controlled(); apiMock.SetupGetWorkspaceTreeNode(fooPath, fooNode); apiMock.SetupGetWorkingBranch(new BranchInfo()); AssetList assetList = new AssetList(); assetList.Add(fooAsset); assetList.Add(barAsset); SelectedAssetGroupInfo groupInfo = SelectedAssetGroupInfo.BuildFromAssetList( assetList, new AssetStatusCacheMock()); Assert.IsFalse(groupInfo.IsControlledSelection); } finally { Plastic.InitializeAPIForTesting(new PlasticAPI()); } }
public void TestIsNotFileSelection() { string barPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); try { PlasticApiMock apiMock = new PlasticApiMock(); Plastic.InitializeAPIForTesting(apiMock); string fooPath = Path.Combine(Path.GetTempPath(), "foo.c"); Directory.CreateDirectory(barPath); Asset fooAsset = new Asset(fooPath); Asset barAsset = new Asset(barPath); WorkspaceTreeNode fooNode = BuildWorkspaceTreeNode.Controlled(); apiMock.SetupGetWorkspaceTreeNode(fooPath, fooNode); apiMock.SetupGetWorkingBranch(new BranchInfo()); AssetList assetList = new AssetList(); assetList.Add(fooAsset); assetList.Add(barAsset); SelectedAssetGroupInfo groupInfo = SelectedAssetGroupInfo.BuildFromAssetList( assetList, new AssetStatusCacheMock()); Assert.IsFalse(groupInfo.IsFileSelection); } finally { Plastic.InitializeAPIForTesting(new PlasticAPI()); if (Directory.Exists(barPath)) { Directory.Delete(barPath); } } }
public void TestHasAnyLockedRemoteInSelection() { try { PlasticApiMock apiMock = new PlasticApiMock(); PlasticGui.Plastic.InitializeAPIForTesting(apiMock); string fooPath = Path.Combine(Path.GetTempPath(), "foo.c"); string barPath = Path.Combine(Path.GetTempPath(), "bar.c"); Asset fooAsset = new Asset(fooPath); Asset barAsset = new Asset(barPath); WorkspaceTreeNode fooNode = BuildWorkspaceTreeNode.Controlled(); WorkspaceTreeNode barNode = BuildWorkspaceTreeNode.Controlled(); apiMock.SetupGetWorkspaceTreeNode(fooPath, fooNode); apiMock.SetupGetWorkspaceTreeNode(barPath, barNode); apiMock.SetupGetWorkingBranch(new BranchInfo()); AssetList assetList = new AssetList(); assetList.Add(fooAsset); assetList.Add(barAsset); AssetStatusCacheMock assetStatusCache = new AssetStatusCacheMock(); assetStatusCache.SetStatus(fooPath, AssetStatus.LockedRemote); SelectedAssetGroupInfo groupInfo = SelectedAssetGroupInfo.BuildFromAssetList( assetList, assetStatusCache); Assert.IsTrue(groupInfo.HasAnyRemoteLockedInSelection); } finally { PlasticGui.Plastic.InitializeAPIForTesting(new PlasticAPI()); } }