To() public method

Outputs the token replaced to a file
Occurs if the file already exists
public To ( string destination ) : void
destination string the destination path
return void
示例#1
0
 public void To_ShouldFailIfFileExists()
 {
     string destination = "c:\\temp";
     var fs = MockRepository.GenerateStub<IFileSystemWrapper>();
     fs.Stub(x => x.FileExists(destination)).Return(true);
     var replacer = new TokenReplacer(fs, "garbage");
     replacer.To(destination);
 }
示例#2
0
        public void To_ShouldFailIfFileExists()
        {
            string destination = "c:\\temp";
            var    fs          = MockRepository.GenerateStub <IFileSystemWrapper>();

            fs.Stub(x => x.FileExists(destination)).Return(true);
            var replacer = new TokenReplacer(fs, "garbage");

            replacer.To(destination);
        }
示例#3
0
        public void To_ShouldWriteOutFileIfFileDoesNotExist()
        {
            string destination = "c:\\temp\non.txt";
            string input = "garbage";

            var fs = MockRepository.GenerateStub<IFileSystemWrapper>();
            fs.Stub(x => x.FileExists(destination)).Return(false);

            var replacer = new TokenReplacer(fs, input);
            replacer.To(destination);

            fs.AssertWasCalled(x=>x.WriteAllText(destination, input));
        }