public void BindToSourceControlAddsPaths() { var root = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); // Use short paths for the names to test that full paths are used var paths = new string[] { Path.GetRandomFileName(), Path.GetRandomFileName(), Path.GetRandomFileName(), }; var workspace = new Mock <ITfsWorkspace>(); var target = new TfsFileSystem(workspace.Object, root); target.BindToSourceControl(paths); var expectedPaths = new string[] { Path.Combine(root, paths[0]), Path.Combine(root, paths[1]), Path.Combine(root, paths[2]), }; // Validate the full paths were used when binding workspace.Verify(w => w.PendAdd(It.Is <IEnumerable <string> >(v => !v.Except(expectedPaths).Any())), Times.Once()); }
public void BindToSourceControlThrowsArgumentNullExceptionIfPathIsNull() { var root = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); var target = new TfsFileSystem(Mock.Of<ITfsWorkspace>(), root); var exception = Assert.Throws<ArgumentNullException>(() => target.BindToSourceControl(null)); Assert.Equal("paths", exception.ParamName, StringComparer.Ordinal); }
public void BindToSourceControlThrowsArgumentNullExceptionIfPathIsNull() { var root = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); var target = new TfsFileSystem(Mock.Of <ITfsWorkspace>(), root); var exception = Assert.Throws <ArgumentNullException>(() => target.BindToSourceControl(null)); Assert.Equal("paths", exception.ParamName, StringComparer.Ordinal); }
public void BindToSourceControlAddsPaths() { var root = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); // Use short paths for the names to test that full paths are used var paths = new string[] { Path.GetRandomFileName(), Path.GetRandomFileName(), Path.GetRandomFileName(), }; var workspace = new Mock<ITfsWorkspace>(); var target = new TfsFileSystem(workspace.Object, root); target.BindToSourceControl(paths); var expectedPaths = new string[] { Path.Combine(root, paths[0]), Path.Combine(root, paths[1]), Path.Combine(root, paths[2]), }; // Validate the full paths were used when binding workspace.Verify(w => w.PendAdd(It.Is<IEnumerable<string>>(v => !v.Except(expectedPaths).Any() )), Times.Once()); }