public void GetGenreTest() { using (var cursor = Substitute.For <ICursor>()) { cursor.GetString(0).Returns("genre"); cursor.GetInt(1).Returns(7); cursor.GetColumnIndex("name").Returns(0); cursor.GetColumnIndex("count").Returns(1); using (var dataAccess = Substitute.For <IDataAccess>()) { dataAccess.ExecuteQueryWithParametersAsync(Arg.Any <string>(), Arg.Any <List <SQLiteParameter> >()).Returns(cursor); using (var statisticsController = new StatisticsController(dataAccess)) { var countAlbumsPerGenre = statisticsController.GetCountOfAlbumsPerGenreAsync().Result; Assert.IsNotNull(countAlbumsPerGenre); Assert.IsInstanceOf <Dictionary <string, int> >(countAlbumsPerGenre); Assert.AreEqual(1, countAlbumsPerGenre.Count); Assert.IsTrue(countAlbumsPerGenre.ContainsKey("genre")); Assert.AreEqual(7, countAlbumsPerGenre["genre"]); } } } }