本文整理汇总了C#中Keen.Core.KeenClient.QueryIntervalGroupAsync方法的典型用法代码示例。如果您正苦于以下问题:C# KeenClient.QueryIntervalGroupAsync方法的具体用法?C# KeenClient.QueryIntervalGroupAsync怎么用?C# KeenClient.QueryIntervalGroupAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keen.Core.KeenClient
的用法示例。
在下文中一共展示了KeenClient.QueryIntervalGroupAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectUnique_ValidAbsoluteIntervalGroup_Success
public async void SelectUnique_ValidAbsoluteIntervalGroup_Success()
{
var client = new KeenClient(settingsEnv);
var prop = "field1";
var timeframe = new QueryAbsoluteTimeframe(DateTime.Now.AddDays(-1), DateTime.Now);
var interval = QueryInterval.EveryNHours(4);
var groupby = "field1";
var resultl = "hello,goodbye,I'm late";
IEnumerable<QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>> result =
new List<QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>>()
{
new QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>(
new List<QueryGroupValue<string>>(){
new QueryGroupValue<string>(resultl, "abc"),
new QueryGroupValue<string>(resultl, "def")
},
timeframe.Start, timeframe.End
),
new QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>(
new List<QueryGroupValue<string>>(){
new QueryGroupValue<string>(resultl, "abc"),
new QueryGroupValue<string>(resultl, "def")
},
timeframe.Start, timeframe.End
),
};
Mock<IQueries> queryMock = null;
if (UseMocks)
{
queryMock = new Mock<IQueries>();
queryMock.Setup(m => m.Metric(
It.Is<QueryType>(q => q == QueryType.SelectUnique()),
It.Is<string>(c => c == testCol),
It.Is<string>(p => p == prop),
It.Is<string>(g => g == groupby),
It.Is<QueryAbsoluteTimeframe>(t => t == timeframe),
It.Is<QueryInterval>(i => i == interval),
It.Is<IEnumerable<QueryFilter>>(f => f == null),
It.Is<string>(t => t == "")
))
.Returns(Task.FromResult(result));
client.Queries = queryMock.Object;
}
var counts = (await client.QueryIntervalGroupAsync(QueryType.SelectUnique(), testCol, prop, groupby, timeframe, interval)).ToList();
if (null != queryMock)
queryMock.VerifyAll();
}
示例2: Query_ValidRelativeGroupInterval_Success
public async void Query_ValidRelativeGroupInterval_Success()
{
var client = new KeenClient(settingsEnv);
var timeframe = QueryRelativeTimeframe.PreviousNDays(2);
var interval = QueryInterval.EveryNHours(2);
var groupby = "field1";
IEnumerable<QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>> reply = new List<QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>>()
{
new QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>(
new List<QueryGroupValue<string>>()
{
new QueryGroupValue<string>( "1", "field1" ),
new QueryGroupValue<string>( "1", "field1" ),
},
DateTime.Now, DateTime.Now.AddSeconds(2)
),
new QueryIntervalValue<IEnumerable<QueryGroupValue<string>>>(
new List<QueryGroupValue<string>>()
{
new QueryGroupValue<string>( "2", "field1" ),
new QueryGroupValue<string>( "2", "field1" ),
},
DateTime.Now, DateTime.Now.AddSeconds(2)
),
};
Mock<IQueries> queryMock = null;
if (UseMocks)
{
queryMock = new Mock<IQueries>();
queryMock.Setup(m => m.Metric(
It.Is<QueryType>(q => q == QueryType.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<QueryInterval>(i => i == interval),
It.Is<IEnumerable<QueryFilter>>(f => f == null),
It.Is<string>(z => z == "")))
.Returns(Task.FromResult(reply));
client.Queries = queryMock.Object;
}
var count = (await client.QueryIntervalGroupAsync(QueryType.Count(), testCol, "", groupby, timeframe, interval)).ToList();
Assert.IsNotNull(count);
if (null != queryMock)
{
queryMock.VerifyAll();
}
}