public void GetAttachmentReturnsNamedAttachment()
 {
     var log = new StructuredDocument();
     var data = new AttachmentData("foo", MimeTypes.Binary, AttachmentType.Binary, null, new byte[0]);
     log.Attachments.Add(data);
     log.Attachments.Add(new AttachmentData("bar", MimeTypes.Binary, AttachmentType.Binary, null, new byte[0]));
     Assert.AreSame(data, log.GetAttachment("foo"));
 }
        public void GetStreamReturnsNamedStream()
        {
            var log = new StructuredDocument();
            var stream = new StructuredStream("foo");
            log.Streams.Add(stream);
            log.Streams.Add(new StructuredStream("bar"));

            Assert.AreSame(stream, log.GetStream("foo"));
        }
        static TeamCityExtensionTest()
        {
            StructuredDocumentWriter logWriter = new StructuredDocumentWriter();
            logWriter.ConsoleOutput.WriteLine("output");
            logWriter.ConsoleInput.WriteLine("input");
            logWriter.DebugTrace.WriteLine("trace");
            logWriter.Default.WriteLine("log");
            logWriter.ConsoleError.WriteLine("error");
            logWriter.Failures.WriteLine("failure");
            logWriter.Warnings.WriteLine("warning");
            logWriter.Close();

            ComprehensiveDocument = logWriter.Document;
        }
 /// <summary>
 /// Creates a document writer that builds a new <see cref="StructuredDocument" />.
 /// </summary>
 public StructuredDocumentWriter()
 {
     document = new StructuredDocument();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a document writer that builds a new <see cref="StructuredDocument" />.
 /// </summary>
 public StructuredDocumentWriter()
 {
     document = new StructuredDocument();
 }
Ejemplo n.º 6
0
        public static void AreEqual(StructuredDocument expected, StructuredDocument actual)
        {
            if (expected == null)
            {
                Assert.IsNull(actual);
                return;
            }

            Assert.Over.Pairs(expected.Attachments, actual.Attachments, AreEqual);
            Assert.Over.Pairs(expected.Streams, actual.Streams, AreEqual);
        }
 public void WriteToThrowsIfWriterIsNull()
 {
     var log = new StructuredDocument();
     Assert.Throws<ArgumentNullException>((() => log.WriteTo(null)));
 }
 public void GetStreamThrowsIfNameIsNull()
 {
     var log = new StructuredDocument();
     Assert.Throws<ArgumentNullException>(() => log.GetStream(null));
 }
 public void GetStreamReturnsNullIfStreamNotFound()
 {
     var log = new StructuredDocument();
     log.Streams.Add(new StructuredStream("bar"));
     Assert.IsNull(log.GetAttachment("foo"));
 }
 public void GetAttachmentReturnsNullIfAttachmentNotFound()
 {
     var log = new StructuredDocument();
     log.Attachments.Add(new AttachmentData("bar", MimeTypes.Binary, AttachmentType.Binary, null, new byte[0]));
     Assert.IsNull(log.GetAttachment("foo"));
 }
 public void TestLogIsInitiallyEmpty()
 {
     var log = new StructuredDocument();
     Assert.IsEmpty(log.Streams);
     Assert.IsEmpty(log.Attachments);
 }