本文整理汇总了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);
}
示例2: DeleteNonExistantCollectionSuccess
public async void DeleteNonExistantCollectionSuccess()
{
Application application = new Application(EnvironmentHelper.ApiKey("OrchestrateApiKey"));
var client = new Client(application);
await client.DeleteCollectionAsync("NonExistantCollection");
}
示例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);
}
示例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);
}
示例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);
}
}