protected override void beforeEach() { theCache = new StubOutputCache(MockFor <IRecordedOutput>()) { CacheHits = false }; Services.Inject <IOutputCache>(theCache); theDescription = new Dictionary <string, string>(); MockFor <IResourceHash>().Stub(x => x.Describe()).Return(theDescription); MockFor <IResourceHash>().Stub(x => x.CreateHash()) .Return(theResource); theLogger = MockFor <ILogger>(); Services.Inject <ILogger>(new InteractionContextLogger(theLogger)); Services.PartialMockTheClassUnderTest(); theGeneratedOutput = new RecordedOutput(null); ClassUnderTest.Expect(x => x.CreateOutput(theResource, null)).Constraints(Is.Same(theResource), Is.Anything()) .Return(theGeneratedOutput); ClassUnderTest.Inner = MockFor <IActionBehavior>(); ClassUnderTest.Invoke(); }
public void Replay(IRecordedOutput output) { // We're routing the replay thru IOutputWriter to // make unit testing easier, I think it gives a cleaner // dependency graph, and it makes request tracing work. output.Replay(Writer); }
public void Replay(IRecordedOutput output) { _logger.DebugMessage(() => new ReplayRecordedOutput(output)); // We're routing the replay thru IOutputWriter to // make unit testing easier, I think it gives a cleaner // dependency graph, and it makes request tracing work. output.Replay(Writer); }
public void Replay(IRecordedOutput output) { _logger.DebugMessage(() => new ReplayRecordedOutput(output)); // We're routing the replay thru IOutputWriter to // make unit testing easier, I think it gives a cleaner // dependency graph, and it makes request tracing work. output.Replay(Response); }
protected override void beforeEach() { theWriter = new StubOutputWriter(); Services.Inject <IOutputWriter>(theWriter); theWriter.Output.AppendHeader(HttpResponseHeaders.ETag, "12345"); theResultingOutput = ClassUnderTest.CreateOuput(theResource, x => x.Invoke()); }
protected override void beforeEach() { theWriter = new StubOutputWriter(); Services.Inject <IOutputWriter>(theWriter); theWriter.Output.AppendHeader(HttpResponseHeaders.ETag, "12345"); theWriter.Output.AppendHeader("a", "1"); theHeaders = new HeadersCache(); Services.Inject <IHeadersCache>(theHeaders); theResultingOutput = ClassUnderTest.CreateOutput(theResource, () => MockFor <IActionBehavior>().Invoke()); }
protected override void beforeEach() { theCache = new StubOutputCache(MockFor <IRecordedOutput>()) { CacheHits = false }; Services.Inject <IOutputCache>(theCache); MockFor <ICurrentChain>().Stub(x => x.ResourceHash()) .Return(theResource); Services.PartialMockTheClassUnderTest(); theGeneratedOutput = new RecordedOutput(null); ClassUnderTest.Expect(x => x.CreateOuput(theResource, ClassUnderTest.Invoker)) .Return(theGeneratedOutput); ClassUnderTest.Invoke(); }
public void Replay(IRecordedOutput output) { throw new NotImplementedException(); }
public StubOutputCache(IRecordedOutput output) { _output = output; }
public ReplayRecordedOutput(IRecordedOutput output) { _output = output; }