Пример #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"));
        }
Пример #2
0
        public void GetStreamReturnsNullIfStreamNotFound()
        {
            var log = new StructuredDocument();

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

            Assert.IsEmpty(log.Streams);
            Assert.IsEmpty(log.Attachments);
        }
Пример #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"));
        }
Пример #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"));
        }
Пример #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);
        }
Пример #7
0
        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;
        }
Пример #8
0
        public void GetStreamThrowsIfNameIsNull()
        {
            var log = new StructuredDocument();

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

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