예제 #1
0
        //[TestMethod]
        public void TestMethod1()
        {
            var debugStopwatch = new StopwatchMock(new []
            {
                TimeSpan.FromSeconds(1),
                TimeSpan.FromSeconds(3),
                TimeSpan.FromSeconds(2),
                TimeSpan.FromSeconds(4),
                TimeSpan.FromSeconds(5),
                TimeSpan.FromSeconds(6),
                TimeSpan.FromSeconds(7),
                TimeSpan.FromSeconds(8),
            });

            var asyncDetector = new AsyncDetector(debugStopwatch);

            using (asyncDetector.BeignScope())
            {
                using (asyncDetector.BeignScope())
                {
                    using (asyncDetector.BeignScope())
                    {
                    }

                    using (asyncDetector.BeignScope())
                    {
                    }
                }
            }

            Assert.AreEqual(4, asyncDetector.MaxAsyncDegree);
            Assert.AreEqual(1, asyncDetector.AsyncGroupCount);
        }
예제 #2
0
        public OpenIdAuthenticator_Tests()
        {
            var proactiveAuthTokenRefreshInterval = 5.Seconds();
            var options = new OpenIdAuthenticationOptions("123", "client_id", proactiveAuthTokenRefreshInterval);

            openIdMock = new OpenIdClientMock();

            authStrategyMock = new AuthenticationStrategyMock();
            stopwatchMock    = new StopwatchMock(proactiveAuthTokenRefreshInterval);

            authenticator = new OpenIdAuthenticator(options, openIdMock.Instance, authStrategyMock.Instance, stopwatchMock.StopwatchFactory);
        }
 protected BaseTests(ITestOutputHelper output)
 {
     stopwatchMock = new StopwatchMock(5.Seconds());
     log           = new TestLog(output);
 }