Exemple #1
0
        public void GetActiveAccessTokens_UserSpecified_ActiveTokensForUser()
        {
            var context = new AlvTimeDbContextBuilder()
                          .WithUsers()
                          .CreateDbContext();

            var storage = new AccessTokenStorage(context);

            var tokens = storage.GetActiveTokens(1);

            Assert.Equal(context.AccessTokens.Where(x => x.UserId == 1).ToList().Count(), tokens.Count());
        }
Exemple #2
0
        public void DeleteToken_TokenIdSpecified_TokenWithIdDeleted()
        {
            var context = new AlvTimeDbContextBuilder()
                          .WithPersonalAccessTokens()
                          .WithUsers()
                          .CreateDbContext();

            var storage = new AccessTokenStorage(context);

            storage.DeleteActiveTokens(1, 1);

            var tokens = storage.GetActiveTokens(1);

            Assert.Empty(tokens);
        }
Exemple #3
0
        public void CreateLifetimeToken_FriendlyNameSpecified_TokenWithFriendlyNameCreated()
        {
            var context = new AlvTimeDbContextBuilder()
                          .WithPersonalAccessTokens()
                          .WithUsers()
                          .CreateDbContext();

            var storage = new AccessTokenStorage(context);

            storage.CreateLifetimeToken("new token", 1);

            var tokens = storage.GetActiveTokens(1);

            Assert.Equal(context.AccessTokens.Where(x => x.UserId == 1).ToList().Count(), tokens.Count());
        }