Пример #1
0
        public void ShouldCallWrapperMoveFile()
        {
            string origin      = "c:\\nonexistant.txt";
            string destination = "nonexistant2.txt";

            var buildArtifact     = new File(origin);
            var fileSystemWrapper = MockRepository.GenerateMock <IFileSystemWrapper>();
            var subject           = new RenameFile(fileSystemWrapper, buildArtifact);

            subject.To(destination);
            fileSystemWrapper.AssertWasCalled(x => x.MoveFile(origin, "c:\\\\" + destination));
        }
Пример #2
0
        public void PathShouldBeChangedAfterRename()
        {
            string origin      = "c:\\nonexistant.txt";
            string destination = "nonexistant2.txt";

            var buildArtifact     = new File(origin);
            var fileSystemWrapper = MockRepository.GenerateMock <IFileSystemWrapper>();
            var subject           = new RenameFile(fileSystemWrapper, buildArtifact);

            var destinationWithFolder = @"c:\\" + destination;

            fileSystemWrapper.Stub(x => x.MoveFile(origin, destinationWithFolder));
            subject.To(destination);

            Assert.That(buildArtifact.ToString(), Is.EqualTo(destinationWithFolder));
        }