Пример #1
0
        public void ShouildContinueOnError()
        {
            var buildArtifact = new File("c:\\nonexistant.txt");

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

            fileSystemWrapper.Stub(x => x.MoveFile("", "")).IgnoreArguments().Throw(new IOException("Could not do that"));
            subject.ContinueOnError.To("nonexistant2.txt");
        }
Пример #2
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));
        }
Пример #3
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));
        }