public void CreateTextWriterInfoIsSavedWhenCreateTextWriterMethodIsCalled()
		{
			fileService.CreateTextWriterInfoPassedToCreateTextWriter = null;
			CreateTextWriterInfo info =  new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
			fileService.CreateTextWriter(info);
			Assert.AreEqual(info, fileService.CreateTextWriterInfoPassedToCreateTextWriter);
		}
		public void TextWriterReturnedFromCreateTextWriter()
		{
			using (StringWriter stringWriter = new StringWriter(new StringBuilder())) {
				fileService.SetTextWriter(stringWriter);
				CreateTextWriterInfo info = new CreateTextWriterInfo(@"test.tmp", Encoding.UTF8, true);
				Assert.AreEqual(stringWriter, fileService.CreateTextWriter(info));
			}
		}
예제 #3
0
        public override bool Equals(object obj)
        {
            CreateTextWriterInfo rhs = obj as CreateTextWriterInfo;

            if (rhs != null)
            {
                return(Equals(rhs));
            }
            return(false);
        }
		public TextWriter CreateTextWriter(CreateTextWriterInfo createTextWriterInfo)
		{
			return createTextWriterInfo.CreateTextWriter();
		}
		public void SetUpFixture()
		{
			string fileName = Path.GetTempFileName();
			CreateTextWriterInfo info = new CreateTextWriterInfo(fileName, Encoding.UTF8, false);
			textWriter = info.CreateTextWriter();
		}
		TextWriter CreateTextWriter()
		{
			string fileName = fileService.GetTempFileName();
			textWriterInfo = new CreateTextWriterInfo(fileName, Encoding.ASCII, false);
			return fileService.CreateTextWriter(textWriterInfo);
		}
 public TextWriter CreateTextWriter(CreateTextWriterInfo createTextWriterInfo)
 {
     return(createTextWriterInfo.CreateTextWriter());
 }
		bool Equals(CreateTextWriterInfo rhs)
		{
			return (fileName == rhs.fileName) &&
				(encoding == rhs.encoding) &&
				(append == rhs.append);
		}
		public void CreateTextWriterInfoEqualsReturnsFalseWhenNullPassedAsParameter()
		{
			CreateTextWriterInfo lhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
			Assert.IsFalse(lhs.Equals(null));
		}
		public void CreateTextWriterInfosAreNotEqualWhenAppendIsDifferent()
		{
			CreateTextWriterInfo lhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
			CreateTextWriterInfo rhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, false);
			Assert.AreNotEqual(lhs, rhs);
		}
		public void CreateTextWriterInfosAreNotEqualWhenFileNamesAreDifferent()
		{
			CreateTextWriterInfo lhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
			CreateTextWriterInfo rhs = new CreateTextWriterInfo("different-filename.txt", Encoding.UTF8, true);
			Assert.AreNotEqual(lhs, rhs);
		}
		public void CreateTextWriterInfosAreEqualWhenFileNameAndEncodingAndAppendAreEqual()
		{
			CreateTextWriterInfo lhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
			CreateTextWriterInfo rhs = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
			Assert.AreEqual(lhs, rhs);
		}
		public TextWriter CreateTextWriter(CreateTextWriterInfo textWriterInfo)
		{
			createTextWriterInfoPassedToCreateTextWriter = textWriterInfo;
			return textWriter;
		}
예제 #14
0
 bool Equals(CreateTextWriterInfo rhs)
 {
     return((fileName == rhs.fileName) &&
            (encoding == rhs.encoding) &&
            (append == rhs.append));
 }