public void DisposingSpoolWritersShouldNotDamageCaches() { _subject.Output.Write("Alpha"); _originator.BeginMemento(); _subject.Output.Write("Beta"); var memento = _originator.EndMemento(); _subject.Output.Write("Gamma"); _subject2.Output.Write("Delta"); _originator2.DoMemento(memento); _subject2.Output.Write("Epsilon"); Assert.That(_subject.Output.ToString(), Is.EqualTo("AlphaBetaGamma")); Assert.That(_subject2.Output.ToString(), Is.EqualTo("DeltaBetaEpsilon")); _subject.Output.Dispose(); Assert.That(_subject2.Output.ToString(), Is.EqualTo("DeltaBetaEpsilon")); _subject2.Output.Dispose(); var subject3 = new SparkViewContext { Output = new SpoolWriter() }; subject3.Output.Write("Zeta"); new CacheOriginator(subject3).DoMemento(memento); subject3.Output.Write("Eta"); Assert.That(subject3.Output.ToString(), Is.EqualTo("ZetaBetaEta")); }
public void Init() { _subject = new SparkViewContext { Output = new SpoolWriter() }; _originator = new CacheOriginator(_subject); _subject2 = new SparkViewContext { Output = new SpoolWriter() }; _originator2 = new CacheOriginator(_subject2); }
public CacheOriginator(SparkViewContext state) { _state = state; }
public void DisposingSpoolWritersShouldNotDamageCaches() { _subject.Output.Write("Alpha"); _originator.BeginMemento(); _subject.Output.Write("Beta"); var memento = _originator.EndMemento(); _subject.Output.Write("Gamma"); _subject2.Output.Write("Delta"); _originator2.DoMemento(memento); _subject2.Output.Write("Epsilon"); Assert.That(_subject.Output.ToString(), Is.EqualTo("AlphaBetaGamma")); Assert.That(_subject2.Output.ToString(), Is.EqualTo("DeltaBetaEpsilon")); _subject.Output.Dispose(); Assert.That(_subject2.Output.ToString(), Is.EqualTo("DeltaBetaEpsilon")); _subject2.Output.Dispose(); var subject3 = new SparkViewContext { Output = new SpoolWriter() }; subject3.Output.Write("Zeta"); new CacheOriginator(subject3).DoMemento(memento); subject3.Output.Write("Eta"); Assert.That(subject3.Output.ToString(), Is.EqualTo("ZetaBetaEta")); }
public void Init() { _subject = new SparkViewContext {Output = new SpoolWriter()}; _originator = new CacheOriginator(_subject); _subject2 = new SparkViewContext { Output = new SpoolWriter() }; _originator2 = new CacheOriginator(_subject2); }
public CacheOriginator(SparkViewContext state) { _state = state; }