public async void Count_ValidRelativeGroup_Success() { var client = new KeenClient(settingsEnv); var timeframe = QueryRelativeTimeframe.PreviousNDays(2); var groupby = "field1"; IEnumerable<QueryGroupValue<int>> reply = new List<QueryGroupValue<int>>() { new QueryGroupValue<int>( 0, "field1" ), new QueryGroupValue<int>( 0, "field1" ), }; Mock<IQueries> queryMock = null; if (UseMocks) { queryMock = new Mock<IQueries>(); queryMock.Setup(m => m.Metric<int>( It.Is<string>(me => me == "count"), It.Is<string>(c => c == testCol), It.Is<string>(p => p == "-"), It.Is<string>(g => g == groupby), It.Is<QueryTimeframe>(t => t == timeframe), It.Is<IEnumerable<QueryFilter>>(f => f == null), It.Is<string>(z => z == ""))) .Returns(Task.FromResult(reply)); client.Queries = queryMock.Object; } var count = await client.QueryCountGroupAsync(testCol, groupby, timeframe); Assert.IsNotNull(count); if (null != queryMock) { queryMock.Verify(m => m.Metric<int>( It.Is<string>(me => me == "count"), It.Is<string>(c => c == testCol), It.Is<string>(p => p == "-"), It.Is<string>(g => g == groupby), It.Is<QueryTimeframe>(t => t == timeframe), It.Is<IEnumerable<QueryFilter>>(f => f == null), It.Is<string>(z => z == "")), Times.Once()); } }