当前位置: 首页>>代码示例>>C#>>正文


C# KeenClient.GetSchema方法代码示例

本文整理汇总了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");
            });
        }
开发者ID:kidchenko,项目名称:keen-sdk-net,代码行数:21,代码来源:KeenClientTest.cs

示例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"));
        }
开发者ID:kidchenko,项目名称:keen-sdk-net,代码行数:14,代码来源:KeenClientTest.cs

示例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(""));
 }
开发者ID:kidchenko,项目名称:keen-sdk-net,代码行数:6,代码来源:KeenClientTest.cs

示例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"));
 }
开发者ID:kidchenko,项目名称:keen-sdk-net,代码行数:15,代码来源:KeenClientTest.cs

示例5: GetCollectionSchema_NullProjectId_Throws

 public void GetCollectionSchema_NullProjectId_Throws()
 {
     var client = new KeenClient(settingsEnv);
     Assert.Throws<KeenException>(() => client.GetSchema(null));
 }
开发者ID:kidchenko,项目名称:keen-sdk-net,代码行数:5,代码来源:KeenClientTest.cs


注:本文中的Keen.Core.KeenClient.GetSchema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。