From 0a16b067666eee8ce3c6482292a62f866b5ffa6f Mon Sep 17 00:00:00 2001 From: Kirill Kovalev Date: Mon, 2 Dec 2024 19:18:22 +0300 Subject: [PATCH] Added assertions to DeserializeClientRegistrationRequestTest --- .../Model/ClientRegistrationRequestTest.cs | 43 ++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/Abblix.Oidc.Server.UnitTests/Model/ClientRegistrationRequestTest.cs b/Abblix.Oidc.Server.UnitTests/Model/ClientRegistrationRequestTest.cs index d5a23bd..133135a 100644 --- a/Abblix.Oidc.Server.UnitTests/Model/ClientRegistrationRequestTest.cs +++ b/Abblix.Oidc.Server.UnitTests/Model/ClientRegistrationRequestTest.cs @@ -28,11 +28,44 @@ namespace Abblix.Oidc.Server.UnitTests.Model; public class ClientRegistrationRequestTest { - [Theory] - [InlineData( - "{\"client_name\":\"dynamic_client_1 RqxLk9BdhK8qC3z\",\"grant_types\":[\"implicit\"],\"jwks\":{\"keys\":[{\"kty\":\"RSA\",\"e\":\"AQAB\",\"use\":\"sig\",\"alg\":\"RS256\",\"n\":\"gUOdYo2PpUUnZzozIPJ-7mK2Z5jYBxjj_5iB2TDnElt8yUc-mcCeOQrsaswPgKx2KMSJ50kwrFHHEuNyiDhgNMgtmJ98RuhggXaPF1fmmHss_Wc1OSqyGYLWbEzYGsRck5yTVP4xsPYAeP5xkkLze_FXJvwITNu2aGxXEYwokkrcWgL3AsXtYKClIwmacHhVNEMn-ALe3sMTifx4F8TqmNAlD4FPga094txHJNo2Ho6z4kn5L4uq_WXklDjaIDOqQZtdn0emXig3RHQcOtepFcXt7pcK9E2M3kxKFOMPpY8c4kaDfQ41jv23vbm9oDTh5s3TB0ZwcKJXj4-06gwTWw\"}]},\"token_endpoint_auth_method\":\"client_secret_basic\",\"response_types\":[\"id_token token\"],\"redirect_uris\":[\"https://www.certification.openid.net/test/a/Abblix/callback\"],\"contacts\":[\"certification@oidf.org\"]}")] - public void DeserializeClientRegistrationRequestTest(string json) + [Fact] + public void DeserializeClientRegistrationRequestTest() { - JsonSerializer.Deserialize(json); + const string json = + """ + { + "client_name": "dynamic_client_1 RqxLk9BdhK8qC3z", + "grant_types": [ + "implicit" + ], + "jwks": { + "keys": [ + { + "kty": "RSA", + "e": "AQAB", + "use": "sig", + "alg": "RS256", + "n": "gUOdYo2PpUUnZzozIPJ-7mK2Z5jYBxjj_5iB2TDnElt8yUc-mcCeOQrsaswPgKx2KMSJ50kwrFHHEuNyiDhgNMgtmJ98RuhggXaPF1fmmHss_Wc1OSqyGYLWbEzYGsRck5yTVP4xsPYAeP5xkkLze_FXJvwITNu2aGxXEYwokkrcWgL3AsXtYKClIwmacHhVNEMn-ALe3sMTifx4F8TqmNAlD4FPga094txHJNo2Ho6z4kn5L4uq_WXklDjaIDOqQZtdn0emXig3RHQcOtepFcXt7pcK9E2M3kxKFOMPpY8c4kaDfQ41jv23vbm9oDTh5s3TB0ZwcKJXj4-06gwTWw" + } + ] + }, + "token_endpoint_auth_method": "client_secret_basic", + "response_types": [ + "id_token token" + ], + "redirect_uris": [ + "https://www.certification.openid.net/test/a/Abblix/callback" + ], + "contacts": [ + "certification@oidf.org" + ] + } + """; + var req = JsonSerializer.Deserialize(json); + Assert.NotNull(req); + Assert.Equal("dynamic_client_1 RqxLk9BdhK8qC3z", req.ClientName); + Assert.Equal(["implicit"], req.GrantTypes); + Assert.Equal([["id_token", "token"]], req.ResponseTypes); + Assert.Equal(["certification@oidf.org"], req.Contacts); } }