public async Task AuthenticationManager_DisplaysRightUI_WhenPathsAreMissing(UIValidator validator, string methodName)
        {
            // Arrange
            var renderer      = new TestRenderer(new ServiceCollection().BuildServiceProvider());
            var jsRuntime     = new TestJsRuntime();
            var authenticator = new TestRemoteAuthenticatorView(new RemoteAuthenticationApplicationPathsOptions(), jsRuntime);

            renderer.Attach(authenticator);

            var parameters = ParameterView.FromDictionary(new Dictionary <string, object>
            {
                [_action] = validator.Action
            });

            // Act
            await renderer.Dispatcher.InvokeAsync <object>(() => authenticator.SetParametersAsync(parameters));

            validator.RetrieveOriginalRender(authenticator);
            validator.SetupFakeRender(authenticator);
            Task result = await renderer.Dispatcher.InvokeAsync <Task>(() => authenticator.SetParametersAsync(parameters));


            // Assert
            Assert.True(validator.WasCalled);
            Assert.Equal(methodName, validator.OriginalRender.Method.Name);
            Assert.Equal(default, jsRuntime.LastInvocation);
Esempio n. 2
0
    public async Task AuthenticationManager_DisplaysRightUI_WhenPathsAreMissing(UIValidator validator, string methodName)
    {
        // Arrange
        var renderer = new TestRenderer(new ServiceCollection().BuildServiceProvider());
        var testNavigationManager = new TestNavigationManager("https://www.example.com/", "Some error message.", "https://www.example.com/");
        var logger        = new TestLoggerFactory(new TestSink(), false).CreateLogger <RemoteAuthenticatorViewCore <RemoteAuthenticationState> >();
        var authenticator = new TestRemoteAuthenticatorView(new RemoteAuthenticationApplicationPathsOptions(), testNavigationManager);

        authenticator.Logger = logger;
        renderer.Attach(authenticator);

        var parameters = ParameterView.FromDictionary(new Dictionary <string, object>
        {
            [_action] = validator.Action
        });

        // Act
        await renderer.Dispatcher.InvokeAsync <object>(() => authenticator.SetParametersAsync(parameters));

        validator.RetrieveOriginalRender(authenticator);
        validator.SetupFakeRender(authenticator);
        Task result = await renderer.Dispatcher.InvokeAsync <Task>(() => authenticator.SetParametersAsync(parameters));

        // Assert
        Assert.True(validator.WasCalled);
        Assert.Equal(methodName, validator.OriginalRender.Method.Name);
    }
        public async Task AuthenticationManager_DisplaysRightUI_ForEachStateAsync(UIValidator validator)
        {
            // Arrange
            var renderer      = new TestRenderer(new ServiceCollection().BuildServiceProvider());
            var authenticator = new TestRemoteAuthenticatorView();

            renderer.Attach(authenticator);
            validator.SetupFakeRender(authenticator);

            var parameters = ParameterView.FromDictionary(new Dictionary <string, object>
            {
                [_action] = validator.Action
            });

            // Act
            await renderer.Dispatcher.InvokeAsync <object>(() => authenticator.SetParametersAsync(parameters));

            // Assert
            Assert.True(validator.WasCalled);
        }
    public async Task AuthenticationManager_DoesNotThrowExceptionOnDisplaysUI_WhenPathsAreMissing(UIValidator validator)
    {
        // Arrange
        var renderer      = new TestRenderer(new ServiceCollection().BuildServiceProvider());
        var authenticator = new TestRemoteAuthenticatorView(new RemoteAuthenticationApplicationPathsOptions());

        renderer.Attach(authenticator);
        validator.SetupFakeRender(authenticator);

        var parameters = ParameterView.FromDictionary(new Dictionary <string, object>
        {
            [_action] = validator.Action
        });

        // Act
        Task result = await renderer.Dispatcher.InvokeAsync <Task>(() => authenticator.SetParametersAsync(parameters));

        // Assert
        Assert.Null(result.Exception);
    }
Esempio n. 5
0
    public async Task AuthenticationManager_DoesNotThrowExceptionOnDisplaysUI_WhenPathsAreMissing(UIValidator validator)
    {
        // Arrange
        var renderer = new TestRenderer(new ServiceCollection().BuildServiceProvider());
        var testNavigationManager = new TestNavigationManager("https://www.example.com/", "Some error message.", "https://www.example.com/");
        var logger        = new TestLoggerFactory(new TestSink(), false).CreateLogger <RemoteAuthenticatorViewCore <RemoteAuthenticationState> >();
        var authenticator = new TestRemoteAuthenticatorView(new RemoteAuthenticationApplicationPathsOptions(), testNavigationManager);

        authenticator.Logger = logger;
        renderer.Attach(authenticator);
        validator.SetupFakeRender(authenticator);

        var parameters = ParameterView.FromDictionary(new Dictionary <string, object>
        {
            [_action] = validator.Action
        });

        // Act
        Task result = await renderer.Dispatcher.InvokeAsync <Task>(() => authenticator.SetParametersAsync(parameters));

        // Assert
        Assert.Null(result.Exception);
    }
Esempio n. 6
0
    public async Task AuthenticationManager_DisplaysRightUI_ForEachStateAsync(UIValidator validator)
    {
        // Arrange
        var renderer = new TestRenderer(new ServiceCollection().BuildServiceProvider());
        var testNavigationManager = new TestNavigationManager("https://www.example.com/", "Some error message.", "https://www.example.com/");
        var logger        = new TestLoggerFactory(new TestSink(), false).CreateLogger <RemoteAuthenticatorViewCore <RemoteAuthenticationState> >();
        var authenticator = new TestRemoteAuthenticatorView(testNavigationManager);

        authenticator.Logger = logger;
        renderer.Attach(authenticator);
        validator.SetupFakeRender(authenticator);

        var parameters = ParameterView.FromDictionary(new Dictionary <string, object>
        {
            [_action] = validator.Action
        });

        // Act
        await renderer.Dispatcher.InvokeAsync <object>(() => authenticator.SetParametersAsync(parameters));

        // Assert
        Assert.True(validator.WasCalled);
    }