public void NetCoreFactory_System()
        {
            // Arrange
            var webUIFactory = new Net5WebUiFactory();

            // Act
            var webUi = webUIFactory.CreateAuthenticationDialog(_parent, WebViewPreference.System, _requestContext);

            // Assert
            Assert.IsTrue(webUi is DefaultOsBrowserWebUi);
        }
        public void Embedded()
        {
            // Arrange
            var webUIFactory = new Net5WebUiFactory((_) => true);

            // Act
            var webUi = webUIFactory.CreateAuthenticationDialog(_parent, WebViewPreference.Embedded, _requestContext);

            // Assert
            Assert.IsTrue(webUi is WebView2WebUi);
        }
コード例 #3
0
        public void DefaultEmbedded_WebView2Available()
        {
            // Arrange
            var webUIFactory = new Net5WebUiFactory(() => true);


            // Act
            var webUi = webUIFactory.CreateAuthenticationDialog(
                _parent,
                WebViewPreference.NotSpecified,
                _requestContext);

            // Assert
            Assert.IsTrue(webUi is WebView2WebUi);
        }
        public void DefaultEmbedded_WebView2NotAvailable()
        {
            // Arrange
            var webUIFactory = new Net5WebUiFactory((_) => false);


            // Act
            var ex = AssertException.Throws <MsalClientException>(() =>
                                                                  webUIFactory.CreateAuthenticationDialog(
                                                                      _parent,
                                                                      WebViewPreference.NotSpecified,
                                                                      _requestContext));

            // Assert
            Assert.AreEqual(MsalError.WebView2NotInstalled, ex.ErrorCode);
        }