示例#1
0
    public async Task GivenDirectoryEntry_WhenRoundTrip_Success()
    {
        const string issuer = "*****@*****.**";

        IdentityClient client = TestApplication.GetIdentityClient();

        var documentId = new DocumentId("test/unit-tests-identity/identity1");

        var query = new QueryParameter()
        {
            Filter    = "test/unit-tests-identity",
            Recursive = false,
        };

        await client.Delete(documentId);

        var request = new IdentityEntryRequest
        {
            DirectoryId = (string)documentId,
            Issuer      = issuer
        };

        bool success = await client.Create(request);

        success.Should().BeTrue();

        IdentityEntry?entry = await client.Get(documentId);

        entry.Should().NotBeNull();

        await client.Delete(documentId);
    }
示例#2
0
    public async Task Get(string directoryId, string file, CancellationToken token)
    {
        IdentityEntry?entry = await _identityClient.Get((DocumentId)directoryId, token);

        if (entry == null)
        {
            _logger.LogError($"Identity {directoryId} does not exist");
            return;
        }

        string json = Json.Default.SerializeFormat(entry);

        File.WriteAllText(file, json);
        _logger.LogInformation($"Writing directoryId={directoryId} to file {file}");
    }