200b84f49a
* Add Instances base (#6) * Use Uri for checks in GetAccounts function (#8) * Add integration and perf tests to sln (#9) * Remove perf tests (#10) * remove perf tests * do all unit tests * Code coverage (#11) * code coverage * enable codecov for GA * Update README.md * Update coverage and dependencies (#12) * Update coverage and dependencies * fmt * add codecov config * merge DUI3/Alpha into sdk (#13) * merge DUI3/Alpha into sdk * formatting * Merge Objects dui3/alpha -> dev (#14) * merge DUI3/Alpha into sdk * formatting * Objects changes * Objects tests * Unit test project * update codecov to be less intrusive (#15) * update codecov to be less intrusive * fix codecov yaml * add coverage exclusion * Merge sharp `dui3/alpha` -> sdk `main` (#16) * Merge * csharpier format * Fixed polysharp issues * Integration Tests * Fixes * Some nullability fixes (#17) * add coverage exclusion * fix some tests and fix nullability errors --------- Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com> Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using Speckle.Core.Api;
|
|
using Speckle.Core.Api.GraphQL.Models;
|
|
using Speckle.Core.Api.GraphQL.Resources;
|
|
|
|
namespace Speckle.Core.Tests.Integration.API.GraphQL.Resources;
|
|
|
|
[TestOf(typeof(ActiveUserResource))]
|
|
public class ActiveUserResourceTests
|
|
{
|
|
private Client _testUser;
|
|
private ActiveUserResource Sut => _testUser.ActiveUser;
|
|
|
|
[OneTimeSetUp]
|
|
public async Task Setup()
|
|
{
|
|
_testUser = await Fixtures.SeedUserWithClient();
|
|
}
|
|
|
|
[Test]
|
|
public async Task ActiveUserGet()
|
|
{
|
|
var res = await Sut.Get();
|
|
Assert.That(res, Is.Not.Null);
|
|
Assert.That(res!.id, Is.EqualTo(_testUser.Account.userInfo.id));
|
|
}
|
|
|
|
[Test]
|
|
public async Task ActiveUserGet_NonAuthed()
|
|
{
|
|
var result = await Fixtures.Unauthed.ActiveUser.Get();
|
|
Assert.That(result, Is.EqualTo(null));
|
|
}
|
|
|
|
[Test]
|
|
public async Task ActiveUserGetProjects()
|
|
{
|
|
var p1 = await _testUser.Project.Create(new("Project 1", null, null));
|
|
var p2 = await _testUser.Project.Create(new("Project 2", null, null));
|
|
|
|
var res = await Sut.GetProjects();
|
|
|
|
Assert.That(res.items, Has.Exactly(1).Items.With.Property(nameof(Project.id)).EqualTo(p1.id));
|
|
Assert.That(res.items, Has.Exactly(1).Items.With.Property(nameof(Project.id)).EqualTo(p2.id));
|
|
Assert.That(res.items, Has.Count.EqualTo(2));
|
|
}
|
|
|
|
[Test]
|
|
public void ActiveUserGetProjects_NoAuth()
|
|
{
|
|
Assert.ThrowsAsync<SpeckleGraphQLException>(async () => await Fixtures.Unauthed.ActiveUser.GetProjects());
|
|
}
|
|
}
|