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); }
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); }
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)); }