Exemplo n.º 1
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_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);
        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);
        }
Exemplo n.º 4
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);
    }
        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);
        }
Exemplo n.º 6
0
 protected override void UIValidate(LeaveIncDec obj, UIActionType action)
 {
     UIValidator.DoValidate(obj);
 }
Exemplo n.º 7
0
 protected override void UIValidate(Permit obj, UIActionType action)
 {
     UIValidator.DoValidate(obj);
 }
Exemplo n.º 8
0
 protected override void UIValidate(LeaveYearRemain obj, UIActionType action)
 {
     UIValidator.DoValidate(obj);
 }
Exemplo n.º 9
0
 protected override void UIValidate(BasicTraffic obj, UIActionType action)
 {
     UIValidator.DoValidate(obj);
 }
Exemplo n.º 10
0
 protected override void UIValidate(ShiftException obj, UIActionType action)
 {
     UIValidator.DoValidate(obj);
 }
Exemplo n.º 11
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);
    }