private IRecordedOutput getOutputWithEtag(string etag) { var output = new RecordedOutput(null); output.AppendHeader(HttpResponseHeaders.ETag, etag); return(output); }
protected override void beforeEach() { theContent = "some content"; theContentType = "text/xml"; theRecordedOutput = ClassUnderTest.Record(() => { ClassUnderTest.Write(theContentType, theContent); }).As <RecordedOutput>(); }
public bool Equals(RecordedOutput other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Equals(other.Content, Content) && Equals(other.RecordedContentType, RecordedContentType)); }
public AppFlowGameEngine( ILogger <GameEngine> logger, IOptions <AllOptions> options, IEnumerable <State> states, ISpinConfiguration spinConfiguration, Wallet wallet, RecordedOutput output) : base(logger, options, states, spinConfiguration, wallet) { _wallet = wallet; _output = output; _steps = new List <AppFlowStep>(); }
public void should_not_generate_data_on_cache_hit() { var theValue = new RecordedOutput("test/html", "View:Brandon"); MockFor <ICacheProvider>().Stub(cp => cp.Get(theKey)).Return(theValue); execute(); MockFor <ICacheProvider>().AssertWasNotCalled(cp => cp.Insert(theKey, theValue, cacheOptions.Dependency, cacheOptions.AbsoluteExpiration, cacheOptions.SlidingExpiration)); generatorWasCalled.ShouldBeFalse(); wasCalled.ShouldBeTrue(); }
public void recorded_output() { Action action = () => { }; var theRecordedOutput = new RecordedOutput("content type", "the output"); MockFor <IOutputWriter>().Stub(x => x.Record(action)).Return(theRecordedOutput); ClassUnderTest.Record(action); MockFor <IDebugReport>().AssertWasCalled(x => x.AddDetails(new OutputReport() { Contents = theRecordedOutput.Content, ContentType = theRecordedOutput.RecordedContentType })); }
public virtual IRecordedOutput Record(Action action) { var output = new RecordedOutput(_fileSystem); _state = output; try { action(); } finally { revertToNormalWriting(); } return output; }
public virtual IRecordedOutput Record(Action action) { var output = new RecordedOutput(_fileSystem); _outputStates.Push(output); try { action(); } finally { _outputStates.Pop(); } return output; }
protected override void beforeEach() { theContent = "some content"; theNestedContent = "nested content"; theContentType = "text/xml"; theRecordedOutput = ClassUnderTest.Record(() => { ClassUnderTest.Write(theContentType, theContent); theNestedOutput = ClassUnderTest.Record(() => { ClassUnderTest.Write(theContentType, theNestedContent); return(Task.CompletedTask); }).GetAwaiter().GetResult().As <RecordedOutput>(); return(Task.CompletedTask); }).GetAwaiter().GetResult().As <RecordedOutput>(); }
public virtual async Task<IRecordedOutput> Record(Func<Task> inner) { _logger.DebugMessage(() => new StartedRecordingOutput()); var output = new RecordedOutput(_fileSystem); _outputStates.Push(output); try { await inner().ConfigureAwait(false); } finally { _outputStates.Pop(); _logger.DebugMessage(() => new FinishedRecordingOutput(output)); } return output; }
public virtual IRecordedOutput Record(Action action) { _logger.DebugMessage(() => new StartedRecordingOutput()); var output = new RecordedOutput(_fileSystem); _outputStates.Push(output); try { action(); } finally { _outputStates.Pop(); _logger.DebugMessage(() => new FinishedRecordingOutput()); } return output; }
public void Eject_clears() { Func <IRecordedOutput> shouldNotBeCalled = () => { Assert.Fail("Do not call me"); return(null); }; var output1 = getOutputWithEtag("12345"); theOutputCache.Retrieve("12345", () => output1).ShouldBeTheSameAs(output1); theOutputCache.Eject("12345"); var output2 = new RecordedOutput(null); theOutputCache.Retrieve("12345", () => output2).ShouldBeTheSameAs(output2); theOutputCache.Retrieve("12345", shouldNotBeCalled).ShouldBeTheSameAs(output2); theOutputCache.Retrieve("12345", shouldNotBeCalled).ShouldBeTheSameAs(output2); theOutputCache.Retrieve("12345", shouldNotBeCalled).ShouldBeTheSameAs(output2); theOutputCache.Retrieve("12345", shouldNotBeCalled).ShouldBeTheSameAs(output2); theOutputCache.Retrieve("12345", shouldNotBeCalled).ShouldBeTheSameAs(output2); }
public StubOutputWriter() : base(new NulloHttpWriter(), null, new RecordingLogger()) { Output = new RecordedOutput(null); }
public void SetUp() { theHttpResponse = MockRepository.GenerateMock <IHttpResponse>(); theRecordedOutput = new RecordedOutput(new FileSystem()); }
public FinishedRecordingOutput(RecordedOutput output) { _output = output; }
public bool Equals(RecordedOutput other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Content, Content) && Equals(other.RecordedContentType, RecordedContentType); }
public StubOutputWriter() : base(new OwinHttpResponse(), null, new RecordingLogger()) { Output = new RecordedOutput(null); }