Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,35 @@ public async Task PostCollectionAsync_ShouldSucceed_WhenEdgeCollection()
var response = await _collectionApi.PostCollectionAsync(
new PostCollectionBody
{
Name = "MyEdgeCollection",
Name = nameof(PostCollectionAsync_ShouldSucceed_WhenEdgeCollection),
Type = CollectionType.Edge
});

Assert.False(response.Error);
Assert.NotNull(response.Id);
Assert.Equal("MyEdgeCollection", response.Name);
Assert.Equal(
nameof(PostCollectionAsync_ShouldSucceed_WhenEdgeCollection),
response.Name);
Assert.Equal("traditional", response.KeyOptions.Type);
Assert.Equal(CollectionType.Edge, response.Type); // 2 is document collection, 3 is edge collection
}

[Fact]
public async Task PostCollectionAsync_ShouldSucceed_WhenSharding()
{
var response = await _collectionApi.PostCollectionAsync(
new PostCollectionBody
{
Name = nameof(PostCollectionAsync_ShouldSucceed_WhenSharding),
NumberOfShards = 4,
ShardKeys = new string[] { "country" },
ReplicationFactor = 2
});

Assert.False(response.Error);
Assert.NotNull(response.Id);
}

[Fact]
public async Task PostCollectionAsync_ShouldUseQueryParameter()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net;
using System.Collections.Generic;
using System.Net;

namespace ArangoDBNetStandard.CollectionApi.Models
{
Expand Down Expand Up @@ -47,7 +48,7 @@ public class GetCollectionPropertiesResponse
/// which document attributes are used to determine the target shard for documents.
/// This option is meaningless in a single server setup.
/// </summary>
public string ShardKeys { get; set; }
public IEnumerable<string> ShardKeys { get; set; }

/// <summary>
/// In a cluster, this attribute determines how many copies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace ArangoDBNetStandard.CollectionApi.Models
using System.Collections.Generic;

namespace ArangoDBNetStandard.CollectionApi.Models
{
public class PostCollectionBody
{
Expand Down Expand Up @@ -93,7 +95,7 @@ public class PostCollectionBody
/// Values of shard key attributes cannot be changed once set.
/// This option is meaningless in a single server setup.
/// </summary>
public string ShardKeys { get; set; }
public IEnumerable<string> ShardKeys { get; set; }

/// <summary>
/// This attribute specifies the name of the sharding strategy to use for the collection.
Expand Down