本文整理汇总了C#中Keen.Core.KeenClient.GetSchema方法的典型用法代码示例。如果您正苦于以下问题:C# KeenClient.GetSchema方法的具体用法?C# KeenClient.GetSchema怎么用?C# KeenClient.GetSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keen.Core.KeenClient
的用法示例。
在下文中一共展示了KeenClient.GetSchema方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCollectionSchema_ValidProject_Success
public void GetCollectionSchema_ValidProject_Success()
{
var client = new KeenClient(settingsEnv);
if (UseMocks)
client.EventCollection = new EventCollectionMock(settingsEnv,
GetSchema: new Func<string, IProjectSettings, JObject>((c, p) =>
{
if ((p == settingsEnv) && (c == "AddEventTest"))
return JObject.Parse("{\"properties\":{\"AProperty\": \"string\"}}");
else
throw new KeenResourceNotFoundException(c);
}));
Assert.DoesNotThrow(() =>
{
dynamic response = client.GetSchema("AddEventTest");
Assert.NotNull(response["properties"]);
Assert.NotNull(response["properties"]["AProperty"]);
Assert.True((string)response["properties"]["AProperty"] == "string");
});
}
示例2: GetCollectionSchema_ValidProjectIdInvalidSchema_Throws
public void GetCollectionSchema_ValidProjectIdInvalidSchema_Throws()
{
var client = new KeenClient(settingsEnv);
if (UseMocks)
client.EventCollection = new EventCollectionMock(settingsEnv,
GetSchema: new Func<string, IProjectSettings, JObject>((c, p) =>
{
if ((p == settingsEnv) && (c == "DoesntExist"))
throw new KeenResourceNotFoundException();
return new JObject();
}));
Assert.Throws<KeenResourceNotFoundException>(() => client.GetSchema("DoesntExist"));
}
示例3: GetCollectionSchema_EmptyProjectId_Throws
public void GetCollectionSchema_EmptyProjectId_Throws()
{
var settings = new ProjectSettingsProvider(projectId: "X", masterKey: settingsEnv.MasterKey);
var client = new KeenClient(settings);
Assert.Throws<KeenException>(() => client.GetSchema(""));
}
示例4: GetCollectionSchema_InvalidProjectId_Throws
public void GetCollectionSchema_InvalidProjectId_Throws()
{
var settings = new ProjectSettingsProvider(projectId: "X", masterKey: settingsEnv.MasterKey);
var client = new KeenClient(settings);
if (UseMocks)
client.EventCollection = new EventCollectionMock(settings,
GetSchema: new Func<string, IProjectSettings, JObject>((c, p) =>
{
if ((p == settings) && (c == "X"))
throw new KeenResourceNotFoundException();
else
throw new Exception("Unexpected value");
}));
Assert.Throws<KeenResourceNotFoundException>(() => client.GetSchema("X"));
}
示例5: GetCollectionSchema_NullProjectId_Throws
public void GetCollectionSchema_NullProjectId_Throws()
{
var client = new KeenClient(settingsEnv);
Assert.Throws<KeenException>(() => client.GetSchema(null));
}