private void InitializeFakeObjects() { var services = new ServiceCollection(); services.AddSimpleIdentityServerJwt(); var provider = services.BuildServiceProvider(); _jwsGenerator = (IJwsGenerator)provider.GetService(typeof(IJwsGenerator)); _jweGenerator = (IJweGenerator)provider.GetService(typeof(IJweGenerator)); _httpClientFactoryStub = new Mock <IHttpClientFactory>(); _smsHttpClientFactoryStub = new Mock <IHttpClientFactory>(); var requestBuilder = new RequestBuilder(); var postTokenOperation = new PostTokenOperation(_httpClientFactoryStub.Object); var getDiscoveryOperation = new GetDiscoveryOperation(_httpClientFactoryStub.Object); var introspectionOperation = new IntrospectOperation(_httpClientFactoryStub.Object); var revokeTokenOperation = new RevokeTokenOperation(_httpClientFactoryStub.Object); var sendSmsOperation = new SendSmsOperation(_smsHttpClientFactoryStub.Object); var getJsonWebKeysOperation = new GetJsonWebKeysOperation(_httpClientFactoryStub.Object); _clientAuthSelector = new ClientAuthSelector( new TokenClientFactory(postTokenOperation, getDiscoveryOperation), new IntrospectClientFactory(introspectionOperation, getDiscoveryOperation), new RevokeTokenClientFactory(revokeTokenOperation, getDiscoveryOperation)); var getUserInfoOperation = new GetUserInfoOperation(_httpClientFactoryStub.Object); _sidSmsAuthenticateClient = new SidSmsAuthenticateClient(sendSmsOperation); _userInfoClient = new UserInfoClient(getUserInfoOperation, getDiscoveryOperation); _jwksClient = new JwksClient(getJsonWebKeysOperation, getDiscoveryOperation); }
private void InitializeFakeObjects() { _httpClientFactoryStub = new Mock <IHttpClientFactory>(); var postTokenOperation = new PostTokenOperation(_httpClientFactoryStub.Object); var getDiscoveryOperation = new GetDiscoveryOperation(_httpClientFactoryStub.Object); var introspectionOperation = new IntrospectOperation(_httpClientFactoryStub.Object); var revokeTokenOperation = new RevokeTokenOperation(_httpClientFactoryStub.Object); _clientAuthSelector = new ClientAuthSelector( new TokenClientFactory(postTokenOperation, getDiscoveryOperation), new IntrospectClientFactory(introspectionOperation, getDiscoveryOperation), new RevokeTokenClientFactory(revokeTokenOperation, getDiscoveryOperation)); var getUserInfoOperation = new GetUserInfoOperation(_httpClientFactoryStub.Object); _userInfoClient = new UserInfoClient(getUserInfoOperation, getDiscoveryOperation); }
public static void C_CallDelageteWithCovarianceAndContravariance() { // Covariant call // You can use method, which have a parameter of derived type. GetUserInfoOperation printUserInfo = UserHandler.PrintFullName; var userInfo = new FullName("Bill", "Black"); Name userInfoAfterPrinting = printUserInfo(userInfo); Trace.TraceInformation(userInfoAfterPrinting.GetType().ToString()); Trace.TraceInformation(userInfoAfterPrinting.ToString()); // Contravariant call // You can use method, which have an argument of base type printUserInfo = UserHandler.PrintName; userInfoAfterPrinting = printUserInfo(userInfo); Trace.TraceInformation(userInfoAfterPrinting.GetType().ToString()); }