Beispiel #1
0
        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"));
        }
Beispiel #2
0
        public void GetStreamReturnsNullIfStreamNotFound()
        {
            var log = new StructuredDocument();

            log.Streams.Add(new StructuredStream("bar"));
            Assert.IsNull(log.GetAttachment("foo"));
        }
Beispiel #3
0
        public void TestLogIsInitiallyEmpty()
        {
            var log = new StructuredDocument();

            Assert.IsEmpty(log.Streams);
            Assert.IsEmpty(log.Attachments);
        }
Beispiel #4
0
        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"));
        }
Beispiel #5
0
        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"));
        }
Beispiel #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);
        }
        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;
        }
Beispiel #8
0
        public void GetStreamThrowsIfNameIsNull()
        {
            var log = new StructuredDocument();

            Assert.Throws <ArgumentNullException>(() => log.GetStream(null));
        }
Beispiel #9
0
        public void WriteToThrowsIfWriterIsNull()
        {
            var log = new StructuredDocument();

            Assert.Throws <ArgumentNullException>((() => log.WriteTo(null)));
        }