public void FlushMergesCallsWithSameSender() { var sut = new EventBuffer(); var bufferable = CreateBufferInvokedEvent(1, 2); sut.StartBuffering(); sut.Buffer(bufferable.Object, 1); sut.Buffer(bufferable.Object, 2); sut.Flush(); bufferable.Verify(); }
public void FlushKeepsCallsWithDifferentSender() { var sut = new EventBuffer(); var bufferable1 = CreateBufferInvokedEvent(1); var bufferable2 = CreateBufferInvokedEvent(2); sut.StartBuffering(); sut.Buffer(bufferable1.Object, 1); sut.Buffer(bufferable2.Object, 2); sut.Flush(); bufferable1.Verify(); bufferable2.Verify(); }
public void FlushLoopsOverBuffers() { var sut = new EventBuffer(); var bufferable1 = CreateBufferInvokedEvent(1); var bufferable2 = CreateBufferInvokedEvent(2); bufferable1.Setup(b => b.Invoke(It.IsAny <List <int> >())) .Callback(() => sut.Buffer(bufferable2.Object, 2)); sut.StartBuffering(); sut.Buffer(bufferable1.Object, 1); sut.Flush(); bufferable1.Verify(); bufferable2.Verify(); }
public void BufferInvokesWhenNotBuffering() { var sut = new EventBuffer(); var bufferable = CreateImmediatelyInvokedEvent(1); sut.Buffer(bufferable.Object, 1); bufferable.Verify(); }
public void BufferDoesNotInvokeWhenBuffering() { var sut = new EventBuffer(); var bufferable = new Mock <IBufferableEvent <int> >(); sut.StartBuffering(); sut.Buffer(bufferable.Object, 1); bufferable.VerifyNoOtherCalls(); }
public void FlushInvokesBufferedCall() { var sut = new EventBuffer(); var bufferable = CreateBufferInvokedEvent(1); sut.StartBuffering(); sut.Buffer(bufferable.Object, 1); sut.Flush(); bufferable.Verify(); }
public void FlushClearsBuffer() { var sut = new EventBuffer(); var bufferable = new Mock <IBufferableEvent <int> >(); sut.StartBuffering(); sut.Buffer(bufferable.Object, 1); sut.Flush(); bufferable.Reset(); sut.Flush(); bufferable.VerifyNoOtherCalls(); }