Exemplo n.º 1
0
        public void SpecimenRequestedWillWriteCorrectMessageToWriter()
        {
            // Arrange
            var writer  = new StringWriter();
            var builder = new DelegatingTracingBuilder();

            var depth   = new Random().Next(1, 10);
            var request = new object();

            var sut = new TraceWriter(writer, builder);

            // Act
            builder.RaiseSpecimenRequested(new RequestTraceEventArgs(request, depth));
            // Assert
            var expected = new string(' ', depth * 2) + "Requested: " + request + Environment.NewLine;

            Assert.Equal(expected, writer.ToString());
        }
Exemplo n.º 2
0
        public void SpecimenRequestedWillWriteCorrectMessageToWriter()
        {
            // Fixture setup
            var writer  = new StringWriter();
            var builder = new DelegatingTracingBuilder();

            var depth   = new Random().Next(1, 10);
            var request = new object();

            var sut = new TraceWriter(writer, builder);

            // Exercise system
            builder.RaiseSpecimenRequested(new RequestTraceEventArgs(request, depth));
            // Verify outcome
            var expected = new string(' ', depth * 2) + "Requested: " + request + Environment.NewLine;

            Assert.Equal(expected, writer.ToString());
            // Teardown
        }