예제 #1
0
        private Task Setup(List <RefreshToken> subjectATokens, List <RefreshToken> subjectBTokens)
        {
            _store = Factory.Resolve <IRefreshTokenStore>();
            var tasks = new List <Task>();

            tasks.Add(_store.StoreAsync(NotRemovedKey, TestData.RefreshToken()));
            tasks.Add(_store.StoreAsync(RemovedKey, TestData.RefreshToken()));

            for (int i = 0; i < 10; i++)
            {
                var token = TestData.RefreshToken(SubjectA);
                token.LifeTime += (100 + 100 * i);
                token.AccessToken.Client.ClientId = "Client" + i % 2;
                tasks.Add(SaveAsync(token.AccessToken.Client));
                tasks.Add(_store.StoreAsync(SubjectA + i, token));
                subjectATokens.Add(token);
            }

            for (int i = 0; i < 10; i++)
            {
                var token = TestData.RefreshToken(SubjectB);
                token.LifeTime += (100 + 100 * i);
                token.AccessToken.Client.ClientId = "Client" + i % 2;
                tasks.Add(SaveAsync(token.AccessToken.Client));
                tasks.Add(_store.StoreAsync(SubjectB + i, token));
                subjectBTokens.Add(token);
            }

            return(Task.WhenAll(tasks));
        }
        private async Task Setup()
        {
            var store = Factory.Resolve <IRefreshTokenStore>();

            await SaveAsync(TestData.ClientAllProperties());

            var key = GetType().Name;

            await store.StoreAsync(key, TestData.RefreshToken());

            _actual = await store.GetAsync(key);
        }
 public RefreshTokenPersistenceTests(PersistenceTestFixture data)
     : base(data)
 {
     _expected = TestData.RefreshToken();
     _setup    = Setup();
 }