Ejemplo n.º 1
0
        public void Repo_Refreshes_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateUserRefreshes();

            var issuer = UoW.Issuers.Get(QueryExpressionFactory.GetQueryExpression <uvw_Issuer>()
                                         .Where(x => x.Name == TestDefaultConstants.IssuerName).ToLambda())
                         .Single();

            var audience = UoW.Audiences.Get(QueryExpressionFactory.GetQueryExpression <uvw_Audience>()
                                             .Where(x => x.Name == TestDefaultConstants.AudienceName).ToLambda())
                           .Single();

            var user = UoW.Users.Get(QueryExpressionFactory.GetQueryExpression <uvw_User>()
                                     .Where(x => x.UserName == TestDefaultConstants.UserName).ToLambda())
                       .Single();

            var result = UoW.Refreshes.Create(
                Mapper.Map <uvw_Refresh>(new RefreshV1()
            {
                IssuerId     = issuer.Id,
                AudienceId   = audience.Id,
                UserId       = user.Id,
                RefreshType  = ConsumerType.User.ToString(),
                RefreshValue = Base64.CreateString(8),
                ValidFromUtc = DateTime.UtcNow,
                ValidToUtc   = DateTime.UtcNow.AddSeconds(60),
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_Refresh>();
        }
Ejemplo n.º 2
0
        public void Repo_Refreshes_GetV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateUserRefreshes();

            var results = UoW.Refreshes.Get();

            results.Should().BeAssignableTo <IEnumerable <uvw_Refresh> >();
            results.Count().Should().Be(UoW.Refreshes.Count());
        }
Ejemplo n.º 3
0
        public void Repo_Refreshes_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateUserRefreshes();

            var activity = UoW.Refreshes.Get().First();

            UoW.Refreshes.Delete(activity);
            UoW.Commit();
        }