예제 #1
0
 public CommandMoveOnDI(Axis[] axes, MovePosPrm[] movePosPrms, DI d, StsType stsType)
     : base(axes)
 {
     this.MovePosPrms = movePosPrms;
     this.DI          = d;
     this.StsType     = stsType;
 }
        public static Sts CreateSts(StsType stsType)
        {
            Sts sts;
            switch (stsType)
            {
                case StsType.ADFS:
                    sts = new AdfsSts();
                    break;
                case StsType.AADFederatedWithADFS3:
                    sts = new AadFederatedWithAdfs3Sts();
                    break;
                case StsType.AAD:
                    sts = new AadSts();
                    break;
                case StsType.AdfsPasswordGrant:
                    sts = new AdfsPasswordGrantSts();
                    break;
                case StsType.AadPasswordGrant:
                    sts = new AadPasswordGrantSts();
                    break;
                default:
                    throw new ArgumentException(string.Format("Unsupported STS type '{0}'", stsType));
            }

            return sts;
        }
예제 #3
0
        public void TestMethodSetup()
        {
            AdalTests.InitializeTest();
            StsType stsType = this.GetStsTypeFromContext();

            Sts = SetupStsService(stsType);
        }
        public static Sts CreateSts(StsType stsType)
        {
            Sts sts;

            switch (stsType)
            {
            case StsType.ADFS:
                sts = new AdfsSts();
                break;

            case StsType.AADFederatedWithADFS3:
                sts = new AadFederatedWithAdfs3Sts();
                break;

            case StsType.AAD:
                sts = new AadSts();
                break;

            case StsType.AdfsPasswordGrant:
                sts = new AdfsPasswordGrantSts();
                break;

            case StsType.AadPasswordGrant:
                sts = new AadPasswordGrantSts();
                break;

            default:
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, " Unsupported STS type '{0}'", stsType));
            }

            return(sts);
        }
예제 #5
0
        internal void VerifySingleItemInCache(AuthenticationResultProxy result, StsType stsType)
        {
            List <TokenCacheItem> items = this.context.TokenCache.ReadItems().ToList();

            Verify.AreEqual(1, items.Count);
            Verify.AreEqual(result.AccessToken, items[0].AccessToken);
            Verify.AreEqual(result.IdToken ?? string.Empty, items[0].IdToken ?? string.Empty);
            Verify.IsTrue(stsType == StsType.ADFS || items[0].IdToken != null);
        }
 internal void VerifySingleItemInCache(AuthenticationResultProxy result, StsType stsType)
 {
     List<TokenCacheItem> items = this.context.TokenCache.ReadItems().ToList();
     Verify.AreEqual(1, items.Count);
     Verify.AreEqual(result.AccessToken, items[0].AccessToken);
     Verify.AreEqual(result.RefreshToken, items[0].RefreshToken);
     Verify.AreEqual(result.IdToken, items[0].IdToken);
     Verify.IsTrue(stsType == StsType.ADFS || items[0].IdToken != null);
 }
        protected static Sts SetupStsService(StsType stsType)
        {
            Sts sts;

            if (!StsDictionary.TryGetValue(stsType, out sts))
            {
                sts = StsFactory.CreateSts(stsType);
                StsDictionary.Add(stsType, sts);
            }

            return sts;
        }
예제 #8
0
        protected static Sts SetupStsService(StsType stsType)
        {
            Sts sts;

            if (!StsDictionary.TryGetValue(stsType, out sts))
            {
                sts = StsFactory.CreateSts(stsType);
                StsDictionary.Add(stsType, sts);
            }

            return(sts);
        }
        public void TestMethodSetup()
        {
            AdalTests.InitializeTest();
            StsType stsType = this.GetStsTypeFromContext();

            try
            {
                AuthenticationContextProxy.CallSync = bool.Parse((string)TestContext.DataRow["CallSync"]);
            }
            catch (ArgumentException)
            {
                AuthenticationContextProxy.CallSync = false;
            }

            Sts = SetupStsService(stsType);

            RecorderSettings.SetMockModeByTestContext(TestContext);
            AdalTests.EndBrowserDialogSession();
        }
        public static Sts CreateSts(StsType stsType)
        {
            Sts sts;
            switch (stsType)
            {
                case StsType.ADFS:
                    sts = new AdfsSts();
                    break;
                case StsType.AADFederatedWithADFS3:
                    sts = new AadFederatedWithAdfs3Sts();
                    break;
                case StsType.AAD:
                    sts = new AadSts();
                    break;
                default:
                    throw new ArgumentException(string.Format("Unsupported STS type '{0}'", stsType));
            }

            return sts;
        }
        public static Sts CreateSts(StsType stsType)
        {
            Sts sts = null;

            if (stsType == StsType.ADFS)
            {
                sts = new AdfsSts();
            }
            else if (stsType == StsType.AADFederatedWithADFS3)
            {
                sts = new AadFederatedWithAdfs3Sts();
            }
            else if (stsType == StsType.AAD)
            {
                sts = new AadSts();
            }
            else
            {
                throw new ArgumentException(string.Format("Unsupported STS type '{0}'", stsType));
            }

            return(sts);
        }
예제 #12
0
        public bool Is(StsType stsType)
        {
            bool b = false;

            switch (stsType)
            {
            case StsType.IsRising:
                b = this.IsRising;
                break;

            case StsType.IsFalling:
                b = this.IsFalling;
                break;

            case StsType.High:
                b = this.Value;
                break;

            case StsType.Low:
                b = !this.Value;
                break;
            }
            return(b);
        }
 internal void VerifySingleItemInCache(AuthenticationResultProxy result, StsType stsType)
 {
 }
 private async Task RunTestAsync(TestMethodAsync testMethodAsync, StsType stsType = StsType.AAD)
 {
     await this.RunTestSyncOrAsync(NullTestMethod, testMethodAsync, stsType);
 }
예제 #15
0
 private async Task RunTestAsync(TestMethodAsync testMethodAsync, StsType stsType = StsType.AAD)
 {
     await this.RunTestSyncOrAsync(NullTestMethod, testMethodAsync, stsType);
 }
예제 #16
0
 private void RunTest(TestMethod testMethod, StsType stsType = StsType.AAD)
 {
     this.RunTestSyncOrAsync(testMethod, NullTestMethodAsync, stsType).Wait();
 }
예제 #17
0
 public CommandMoveOnDI(Axis axis, MovePosPrm movePosPrm, DI d, StsType stsType)
     : this(new Axis[] { axis }, new MovePosPrm[] { movePosPrm }, d, stsType)
 {
 }
예제 #18
0
        private async Task RunTestSyncOrAsync(TestMethod testMethod, TestMethodAsync testMethodAsync, StsType stsType)
        {
            this.AppendText(string.Format("{0}: ", (testMethod != NullTestMethod) ? testMethod.Method.Name : testMethodAsync.Method.Name));
            try
            {
                Sts sts = StsFactory.CreateSts(stsType);
                AdalTests.InitializeTest();
                AdalTests.EndBrowserDialogSession();
                if (testMethod != NullTestMethod)
                {
                    testMethod(sts);
                }

                if (testMethodAsync != NullTestMethodAsync)
                {
                    await testMethodAsync(sts);
                }

                this.AppendText("PASSED.\n", Color.Green);
            }
            catch (AssertFailedException)
            {
                this.AppendText("FAILED!\n", Color.Red);
            }
            catch (Exception ex)
            {
                this.AppendText(string.Format("FAILED with exception '{0}'!\n", ex), Color.Red);
            }
        }
 internal void VerifySingleItemInCache(AuthenticationResultProxy result, StsType stsType)
 {
 }
 private void RunTest(TestMethod testMethod, StsType stsType = StsType.AAD)
 {
     this.RunTestSyncOrAsync(testMethod, NullTestMethodAsync, stsType).Wait();
 }
        private async Task RunTestSyncOrAsync(TestMethod testMethod, TestMethodAsync testMethodAsync, StsType stsType)
        {
            this.AppendText(string.Format("{0}: ", (testMethod != NullTestMethod) ? testMethod.Method.Name : testMethodAsync.Method.Name));
            try
            {
                Sts sts = StsFactory.CreateSts(stsType);
                AdalTests.InitializeTest();
                AdalTests.EndBrowserDialogSession();
                if (testMethod != NullTestMethod)
                {
                    testMethod(sts);
                }

                if (testMethodAsync != NullTestMethodAsync)
                {
                    await testMethodAsync(sts);
                }

                this.AppendText("PASSED.\n", Color.Green);
            }
            catch (AssertFailedException)
            {
                this.AppendText("FAILED!\n", Color.Red);
            }
            catch (Exception ex)
            {
                this.AppendText(string.Format("FAILED with exception '{0}'!\n", ex), Color.Red);
            }
        }