Пример #1
0
        public void Repo_Claims_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateClaims();

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

            var result = UoW.Claims.Create(
                Mapper.Map <E_Claim>(new ClaimV1()
            {
                IssuerId    = issuer.Id,
                Subject     = TestDefaultConstants.ClaimSubject,
                Type        = TestDefaultConstants.ClaimName,
                Value       = AlphaNumeric.CreateString(8),
                ValueType   = TestDefaultConstants.ClaimValueType,
                IsDeletable = true,
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <E_Claim>();
        }
Пример #2
0
        public void Repo_States_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateUserStates();

            var state = UoW.States.Get().First();

            UoW.States.Delete(state);
            UoW.Commit();
        }
Пример #3
0
        public void Repo_Audiences_GetV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateAudiences();

            var results = UoW.Audiences.Get();

            results.Should().BeAssignableTo <IEnumerable <E_Audience> >();
            results.Count().Should().Be(UoW.Audiences.Count());
        }
Пример #4
0
        public void Repo_Refreshes_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateAudienceRefreshes();

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

            UoW.Refreshes.Delete(activity);
            UoW.Commit();
        }
Пример #5
0
        public void Repo_Users_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateUsers();

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

            UoW.Users.Delete(user);
            UoW.Commit();
        }
Пример #6
0
        public void Repo_AuthActivity_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateAudiences();

            var activity = UoW.AuthActivity.Get(QueryExpressionFactory.GetQueryExpression <E_AuthActivity>().ToLambda())
                           .First();

            UoW.AuthActivity.Delete(activity);
            UoW.Commit();
        }
Пример #7
0
        public void Repo_Audiences_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateAudiences();

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

            UoW.Audiences.Delete(audience);
            UoW.Commit();
        }
Пример #8
0
        public void Repo_Claims_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateClaims();

            var claim = UoW.Claims.Get(QueryExpressionFactory.GetQueryExpression <E_Claim>()
                                       .Where(x => x.Type == TestDefaultConstants.ClaimName).ToLambda())
                        .Single();

            UoW.Claims.Delete(claim);
            UoW.Commit();
        }
Пример #9
0
        public void Repo_Logins_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateLogins();

            var login = UoW.Logins.Get(QueryExpressionFactory.GetQueryExpression <E_Login>()
                                       .Where(x => x.Name == TestDefaultConstants.LoginName).ToLambda())
                        .Single();

            UoW.Logins.Delete(login);
            UoW.Commit();
        }
Пример #10
0
        public void Repo_Logins_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateLogins();

            var result = UoW.Logins.Create(
                Mapper.Map <E_Login>(new LoginV1()
            {
                Name        = TestDefaultConstants.LoginName,
                LoginKey    = TestDefaultConstants.LoginKey,
                IsDeletable = true,
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <E_Login>();
        }
Пример #11
0
        public void Repo_Claims_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateClaims();

            var claim = UoW.Claims.Get(QueryExpressionFactory.GetQueryExpression <E_Claim>()
                                       .Where(x => x.Type == TestDefaultConstants.ClaimName).ToLambda())
                        .Single();

            claim.Value += "(Updated)";

            var result = UoW.Claims.Update(claim);

            UoW.Commit();

            result.Should().BeAssignableTo <E_Claim>();
        }
Пример #12
0
        public void Repo_Issuers_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateIssuers();

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

            issuer.Name += "(Updated)";

            var result = UoW.Issuers.Update(issuer);

            UoW.Commit();

            result.Should().BeAssignableTo <E_Issuer>();
        }
Пример #13
0
        public void Repo_Audiences_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateAudiences();

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

            audience.Name += "(Updated)";

            var result = UoW.Audiences.Update(audience);

            UoW.Commit();

            result.Should().BeAssignableTo <E_Audience>();
        }
Пример #14
0
        public void Repo_Logins_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateLogins();

            var login = UoW.Logins.Get(QueryExpressionFactory.GetQueryExpression <E_Login>()
                                       .Where(x => x.Name == TestDefaultConstants.LoginName).ToLambda())
                        .Single();

            login.Name += "(Updated)";

            var result = UoW.Logins.Update(login);

            UoW.Commit();

            result.Should().BeAssignableTo <E_Login>();
        }
Пример #15
0
        public void Repo_Issuers_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateIssuers();

            var result = UoW.Issuers.Create(
                Mapper.Map <E_Issuer>(new IssuerV1()
            {
                Name        = TestDefaultConstants.IssuerName,
                IssuerKey   = TestDefaultConstants.IssuerKey,
                IsEnabled   = true,
                IsDeletable = true,
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <E_Issuer>();
        }
Пример #16
0
        public void Repo_AuthActivity_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateAudiences();

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

            var result = UoW.AuthActivity.Create(
                Mapper.Map <E_AuthActivity>(new AuthActivityV1()
            {
                AudienceId   = audience.Id,
                LoginType    = GrantFlowType.ClientCredentialV2.ToString(),
                LoginOutcome = GrantFlowResultType.Success.ToString(),
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <E_AuthActivity>();
        }
Пример #17
0
        public void Repo_States_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateUserStates();

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

            var state = UoW.States.Get(QueryExpressionFactory.GetQueryExpression <E_State>()
                                       .Where(x => x.UserId == user.Id).ToLambda())
                        .First();

            state.StateConsume = true;

            var result = UoW.States.Update(state);

            UoW.Commit();

            result.Should().BeAssignableTo <E_State>();
        }
Пример #18
0
        public void Repo_Users_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateUsers();

            var result = UoW.Users.Create(
                Mapper.Map <E_User>(new UserV1()
            {
                UserName     = TestDefaultConstants.UserName,
                Email        = TestDefaultConstants.UserName,
                PhoneNumber  = NumberAs.CreateString(9),
                FirstName    = "First-" + Base64.CreateString(4),
                LastName     = "Last-" + Base64.CreateString(4),
                IsLockedOut  = false,
                IsHumanBeing = true,
                IsDeletable  = true,
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <E_User>();
        }
Пример #19
0
        public void Repo_Audiences_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateAudiences();

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

            var result = UoW.Audiences.Create(
                Mapper.Map <E_Audience>(new AudienceV1()
            {
                IssuerId    = issuer.Id,
                Name        = TestDefaultConstants.AudienceName,
                IsLockedOut = false,
                IsDeletable = true,
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <E_Audience>();
        }
Пример #20
0
        public void Repo_States_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateUserStates();

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

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

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

            var result = UoW.States.Create(
                Mapper.Map <E_State>(new StateV1()
            {
                IssuerId     = issuer.Id,
                AudienceId   = audience.Id,
                UserId       = user.Id,
                StateValue   = AlphaNumeric.CreateString(32),
                StateType    = ConsumerType.Device.ToString(),
                StateConsume = false,
                ValidFromUtc = DateTime.UtcNow,
                ValidToUtc   = DateTime.UtcNow.AddSeconds(60),
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <E_State>();
        }
Пример #21
0
        public void Repo_Roles_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateRoles();

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

            var result = UoW.Roles.Create(
                Mapper.Map <E_Role>(new RoleV1()
            {
                AudienceId  = audience.Id,
                Name        = TestDefaultConstants.RoleName,
                IsEnabled   = true,
                IsDeletable = true,
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <E_Role>();
        }