private IAggregator <Book> PrepareAggregator(Book[] books) { var aggregator = new BookAggregator(mockedDataWriter.Object, ChannelId, InstrumentName); aggregator.GetSnapshot(books); mockedDataWriter.ResetCalls(); return(aggregator); }
public void SnapshotTest() { var books = BookGenerator.GenerateBooks(13, 100); var bestBid = books.BestBid(); var bestAsk = books.BestAsk(); var aggregator = new BookAggregator(mockedDataWriter.Object, ChannelId, InstrumentName); mockedDataWriter .Setup(d => d.Write(It.IsAny <ResultData>())) .Callback((ResultData data) => { Assert.Equal(data.InstrumentName, InstrumentName); Assert.Equal(data.BestAsk, bestAsk); Assert.Equal(data.BestBid, bestBid); }); aggregator.GetSnapshot(books); mockedDataWriter.Verify(d => d.Write(It.IsAny <ResultData>()), Times.Once); mockedDataWriter.ResetCalls(); }