public void SpecimenFormatterIsGivenCorrectTextWriter() { // Arrange var expectedWriter = new StringWriter(); var sut = new TraceWriter(expectedWriter, new DelegatingTracingBuilder()); bool verified = false; sut.TraceSpecimenFormatter = (tw, r, i) => verified = tw == expectedWriter; // Act var dummyRequest = new object(); var dummyContainer = new DelegatingSpecimenContext(); sut.Create(dummyRequest, dummyContainer); // Assert Assert.True(verified); }
public void CreateWillReturnCorrectResult() { // Arrange var expectedSpecimen = new object(); var stubBuilder = new TracingBuilder(new DelegatingSpecimenBuilder { OnCreate = (r, c) => expectedSpecimen }); var dummyWriter = TextWriter.Null; var sut = new TraceWriter(dummyWriter, stubBuilder); // Act var dummyRequest = new object(); var dummyContainer = new DelegatingSpecimenContext(); var result = sut.Create(dummyRequest, dummyContainer); // Assert Assert.Equal(expectedSpecimen, result); }
public void SpecimenFormatterIsGivenCorrectTextWriter() { // Fixture setup var expectedWriter = new StringWriter(); var sut = new TraceWriter(expectedWriter, new DelegatingTracingBuilder()); bool verified = false; sut.TraceSpecimenFormatter = (tw, r, i) => verified = tw == expectedWriter; // Exercise system var dummyRequest = new object(); var dummyContainer = new DelegatingSpecimenContext(); sut.Create(dummyRequest, dummyContainer); // Verify outcome Assert.True(verified); // Teardown }
public void CreateWillInvokeDecoratedBuilderWithCorrectParameters() { // Arrange var expectedRequest = new object(); var expectedContainer = new DelegatingSpecimenContext(); var verified = false; var mockBuilder = new TracingBuilder(new DelegatingSpecimenBuilder { OnCreate = (r, c) => verified = expectedRequest == r && expectedContainer == c }); var dummyWriter = TextWriter.Null; var sut = new TraceWriter(dummyWriter, mockBuilder); // Act sut.Create(expectedRequest, expectedContainer); // Assert Assert.True(verified, "Mock verified"); }
public void CreateWillReturnCorrectResult() { // Fixture setup var expectedSpecimen = new object(); var stubBuilder = new TracingBuilder(new DelegatingSpecimenBuilder { OnCreate = (r, c) => expectedSpecimen }); var dummyWriter = TextWriter.Null; var sut = new TraceWriter(dummyWriter, stubBuilder); // Exercise system var dummyRequest = new object(); var dummyContainer = new DelegatingSpecimenContext(); var result = sut.Create(dummyRequest, dummyContainer); // Verify outcome Assert.Equal(expectedSpecimen, result); // Teardown }
public void CreateWillInvokeDecoratedBuilderWithCorrectParameters() { // Fixture setup var expectedRequest = new object(); var expectedContainer = new DelegatingSpecimenContext(); var verified = false; var mockBuilder = new TracingBuilder(new DelegatingSpecimenBuilder { OnCreate = (r, c) => verified = expectedRequest == r && expectedContainer == c }); var dummyWriter = TextWriter.Null; var sut = new TraceWriter(dummyWriter, mockBuilder); // Exercise system sut.Create(expectedRequest, expectedContainer); // Verify outcome Assert.True(verified, "Mock verified"); // Teardown }
public Service() { _tracewriter = TraceWriter.Create(new TraceWriterSettings()); InitializeComponent(); }