Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/CouchDB.Driver/Types/ExecutionStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public sealed class ExecutionStats
/// Total execution time in milliseconds as measured by the database.
/// </summary>
[JsonProperty("execution_time_ms")]
public int ExecutionTimeMs { get; internal set; }
public float ExecutionTimeMs { get; internal set; }
}
}
23 changes: 20 additions & 3 deletions tests/CouchDB.Driver.E2ETests/Client_Tests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CouchDB.Driver.Types;
using CouchDB.Driver.Types;
using System.IO;
using System.Linq;
using System.Net.Mime;
Expand All @@ -8,12 +8,13 @@
using CouchDB.Driver.E2ETests.Models;
using CouchDB.Driver.Extensions;
using CouchDB.Driver.Local;
using CouchDB.Driver.Query.Extensions;
using Xunit;

namespace CouchDB.Driver.E2E
{
[Trait("Category", "Integration")]
public class ClientTests: IAsyncLifetime
public class ClientTests : IAsyncLifetime
{
private ICouchClient _client;
private ICouchDatabase<Rebel> _rebels;
Expand All @@ -22,6 +23,9 @@ public async Task InitializeAsync()
{
_client = new CouchClient("http://localhost:5984", c =>
c.UseBasicAuthentication("admin", "admin"));
// ensure the _users database exists to prevent couchdb from
// generating tons of errors in the logs
await _client.GetOrCreateUsersDatabaseAsync();
_rebels = await _client.GetOrCreateDatabaseAsync<Rebel>();
}

Expand Down Expand Up @@ -152,7 +156,7 @@ public async Task Crud_SpecialCharacters()
public async Task Users()
{
var users = await _client.GetOrCreateUsersDatabaseAsync();

CouchUser luke = await users.AddAsync(new CouchUser(name: "luke", password: "lasersword"));
Assert.Equal("luke", luke.Name);

Expand Down Expand Up @@ -266,5 +270,18 @@ public async Task LocalDocuments()
var containsId = docs.Select(d => d.Id).Contains("_local/" + docId);
Assert.True(containsId);
}

[Fact]
public async Task ExecutionStats()
{
await using var context = new MyDeathStarContext();

var rebels = await context.Rebels
.Where(r => r.Age == 19)
.IncludeExecutionStats()
.ToCouchListAsync();

Assert.True(rebels.ExecutionStats.ExecutionTimeMs > 0);
}
}
}