public void SetUp() { Mocker.GetMock <IDiskProvider>(MockBehavior.Strict); _sourceMount = new MockMount() { Name = "source", RootDirectory = @"C:\source".AsOsAgnostic() }; _targetMount = new MockMount() { Name = "target", RootDirectory = @"C:\target".AsOsAgnostic() }; Mocker.GetMock <IDiskProvider>() .Setup(v => v.GetMount(It.IsAny <string>())) .Returns((IMount)null); Mocker.GetMock <IDiskProvider>() .Setup(v => v.GetMount(It.Is <string>(p => p.StartsWith(_sourceMount.RootDirectory)))) .Returns(_sourceMount); Mocker.GetMock <IDiskProvider>() .Setup(v => v.GetMount(It.Is <string>(p => p.StartsWith(_targetMount.RootDirectory)))) .Returns(_targetMount); WithEmulatedDiskProvider(); WithExistingFile(_sourcePath); }
public void should_use_move_on_cifs_if_same_mount() { _sourceMount.DriveFormat = "cifs"; _targetMount = _sourceMount; var result = Subject.TransferFile(_sourcePath, _targetPath, TransferMode.Move); Mocker.GetMock <IDiskProvider>() .Verify(v => v.MoveFile(_sourcePath, _targetPath, false), Times.Once()); Mocker.GetMock <IDiskProvider>() .Verify(v => v.CopyFile(_sourcePath, _targetPath, false), Times.Never()); Mocker.GetMock <IDiskProvider>() .Verify(v => v.DeleteFile(_sourcePath), Times.Never()); }