/// <summary> /// Answer with an AccessSafely which /// writes the abandon call count using "count" every time abandon(...) is called, and /// reads the abandon call count using "count". /// </summary> /// <param name="n">Number of times abandon must be called before readFrom will return</param> /// <returns>Access Safely</returns> public AccessSafely ExpectAbandon(int n) { _abandonSafely = AccessSafely.AfterCompleting(n) .WritingWith <int>("count", x => { }) .ReadingWith("count", () => AbandonCount.Get()); return(_abandonSafely); }
public void Abandon(RequestResponseContext context) { var count = AbandonCount.IncrementAndGet(); _abandonSafely.WriteUsing("count", count); }