private void Setup(int maxFileSize) { target = new XmlWriterRollingTraceListener_Accessor( maxFileSize, "TestListener"); target.fileName = Guid.NewGuid().ToString() + ".xml"; target.textWriterProvider = MockRepository.GenerateStub<Tools.Logging.XmlWriterRollingTraceListener.ITextWriterProvider>(); target.directoryHelper = MockRepository.GenerateStub<Tools.Logging.XmlWriterRollingTraceListener.IDirectoryHelper>(); target.logFileHelper = MockRepository.GenerateStub<Tools.Logging.XmlWriterRollingTraceListener.ILogFileHelper>(); writer = MockRepository.GenerateStub<TextWriter>(); target.textWriterProvider.Stub((p) => p.CreateWriter(null)).IgnoreArguments().Return(writer); target.directoryHelper.Stub((h) => h.CreateDirectory()); target.logFileHelper.Stub((h) => h.IsFileSuitableForWriting).Return(false); log = null; writer.Stub((w) => w.Write(String.Empty)).IgnoreArguments().Repeat.Any().Do((Action<string>)delegate(string s) { log += s; }); }