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


C# Client.DeleteCollectionAsync方法代码示例

本文整理汇总了C#中Client.DeleteCollectionAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Client.DeleteCollectionAsync方法的具体用法?C# Client.DeleteCollectionAsync怎么用?C# Client.DeleteCollectionAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client的用法示例。


在下文中一共展示了Client.DeleteCollectionAsync方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Guards

    public async void Guards()
    {
        Application application = new Application(EnvironmentHelper.ApiKey("OrchestrateApiKey"));
        var client = new Client(application);

        var exception = await Assert.ThrowsAsync<ArgumentException>(
            () => client.DeleteCollectionAsync(string.Empty)
        );
        Assert.Equal("collectionName", exception.ParamName);

        exception = await Assert.ThrowsAsync<ArgumentNullException>(
            () => client.DeleteCollectionAsync(null)
        );
        Assert.Equal("collectionName", exception.ParamName);
    }
开发者ID:nstetich,项目名称:Orchestrate-.NET-SDK,代码行数:15,代码来源:DeleteCollectionTests.cs

示例2: DeleteNonExistantCollectionSuccess

    public async void DeleteNonExistantCollectionSuccess()
    {
        Application application = new Application(EnvironmentHelper.ApiKey("OrchestrateApiKey"));
        var client = new Client(application);

        await client.DeleteCollectionAsync("NonExistantCollection");
    }
开发者ID:nstetich,项目名称:Orchestrate-.NET-SDK,代码行数:7,代码来源:DeleteCollectionTests.cs

示例3: InvalidCredentialsThrowsRequestException

    public async void InvalidCredentialsThrowsRequestException()
    {
        var application = new Application("HaHa");
        var client = new Client(application);

        var exception = await Assert.ThrowsAsync<RequestException>(
            () => client.DeleteCollectionAsync(collectionName)
        );

        Assert.Equal(HttpStatusCode.Unauthorized, exception.StatusCode);
        Assert.Equal("Valid credentials are required.", exception.Message);
    }
开发者ID:nstetich,项目名称:Orchestrate-.NET-SDK,代码行数:12,代码来源:DeleteCollectionTests.cs

示例4: DeleteSuccess

    public async void DeleteSuccess()
    {
        Application application = new Application(EnvironmentHelper.ApiKey("OrchestrateApiKey"));
        var client = new Client(application);

        dynamic item = new ExpandoObject();
        item.Id = 1;

        await client.CreateCollectionAsync(collectionName, Guid.NewGuid().ToString(), item);

        await client.DeleteCollectionAsync(collectionName);
    }
开发者ID:nstetich,项目名称:Orchestrate-.NET-SDK,代码行数:12,代码来源:DeleteCollectionTests.cs

示例5: CreateCollectionSuccess

    public async void CreateCollectionSuccess()
    {
        Application application = new Application(EnvironmentHelper.ApiKey("OrchestrateApiKey"));
        var client = new Client(application);

        try
        {
            dynamic item = new ExpandoObject();
            item.Id = 1;

            string guid = Guid.NewGuid().ToString();
            KvMetadata metaData = await client.CreateCollectionAsync(collectionName, guid, item);

            Assert.Equal(collectionName, metaData.CollectionName);
            Assert.Equal(guid, metaData.Key);
            Assert.True(metaData.VersionReference.Length > 0);
            Assert.Contains(metaData.VersionReference, metaData.Location);
        }
        finally
        {
            await client.DeleteCollectionAsync(collectionName);
        }
    }
开发者ID:nstetich,项目名称:Orchestrate-.NET-SDK,代码行数:23,代码来源:CreateCollectionTests.cs


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