private async Task AddMicrosoftIdentityWebAppCallsWebApi_TestRedirectToIdentityProviderForSignOutEvent( IServiceProvider provider, OpenIdConnectOptions oidcOptions, Func <RedirectContext, Task> redirectFuncMock, ITokenAcquisitionInternal tokenAcquisitionMock) { var(httpContext, authScheme, authProperties) = CreateContextParameters(provider); await oidcOptions.Events.RedirectToIdentityProviderForSignOut(new RedirectContext(httpContext, authScheme, oidcOptions, authProperties)).ConfigureAwait(false); // Assert original RedirectToIdentityProviderForSignOut event and TokenAcquisition method were called await redirectFuncMock.ReceivedWithAnyArgs().Invoke(Arg.Any <RedirectContext>()).ConfigureAwait(false); await tokenAcquisitionMock.ReceivedWithAnyArgs().RemoveAccountAsync(Arg.Any <RedirectContext>()).ConfigureAwait(false); }
private async Task AddMicrosoftIdentityWebAppCallsWebApi_TestAuthorizationCodeReceivedEvent( IServiceProvider provider, OpenIdConnectOptions oidcOptions, Func <AuthorizationCodeReceivedContext, Task> authCodeReceivedFuncMock, ITokenAcquisitionInternal tokenAcquisitionMock) { var(httpContext, authScheme, authProperties) = CreateContextParameters(provider); await oidcOptions.Events.AuthorizationCodeReceived(new AuthorizationCodeReceivedContext(httpContext, authScheme, oidcOptions, authProperties)).ConfigureAwait(false); // Assert original AuthorizationCodeReceived event and TokenAcquisition method were called await authCodeReceivedFuncMock.ReceivedWithAnyArgs().Invoke(Arg.Any <AuthorizationCodeReceivedContext>()).ConfigureAwait(false); await tokenAcquisitionMock.ReceivedWithAnyArgs().AddAccountToCacheFromAuthorizationCodeAsync(Arg.Any <AuthorizationCodeReceivedContext>(), Arg.Any <IEnumerable <string> >()).ConfigureAwait(false); }