本文整理汇总了C#中Keen.Core.KeenClient.QueryCountGroupAsync方法的典型用法代码示例。如果您正苦于以下问题:C# KeenClient.QueryCountGroupAsync方法的具体用法?C# KeenClient.QueryCountGroupAsync怎么用?C# KeenClient.QueryCountGroupAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keen.Core.KeenClient
的用法示例。
在下文中一共展示了KeenClient.QueryCountGroupAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Count_ValidRelativeGroup_Success
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());
}
}