예제 #1
0
        public void GivenTargetExistsAndOverwriteFalse__WhenCallingCopyTo__ShouldNotCallLinker()
        {
            IFileInfo sourceFile = _fileSystem.FileInfo.FromFileName(_sourceFileName);
            IFileInfo targetFile = _fileSystem.FileInfo.FromFileName(_targetFileName);

            FileLinkerSpy  fileLinkerSpy = new FileLinkerSpy();
            LinkCopyPolicy sut           = new LinkCopyPolicy(fileLinkerSpy);

            sut.CopyTo(sourceFile, targetFile, false);

            Assert.IsFalse(fileLinkerSpy.CreateLinkWasCalled);
        }
예제 #2
0
        public void GivenSourceAndTargetFileInfo__WhenCopyTo__ShouldCallLinkerWithFullFileNames()
        {
            IFileInfo sourceFile = _fileSystem.FileInfo.FromFileName(_sourceFileName);
            IFileInfo targetFile = _fileSystem.FileInfo.FromFileName(_targetFileName);

            FileLinkerSpy  fileLinkerSpy = new FileLinkerSpy();
            LinkCopyPolicy sut           = new LinkCopyPolicy(fileLinkerSpy);

            sut.CopyTo(sourceFile, targetFile, true);

            Assert.AreEqual(_sourceFileName, fileLinkerSpy.ReceivedSource);
            Assert.AreEqual(_targetFileName, fileLinkerSpy.ReceivedTarget);
        }