Beispiel #1
0
        public void Repo_Claims_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

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

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_Claim>();
        }
Beispiel #2
0
        public void Repo_Refreshes_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

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

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

            var result = UoW.Refreshes.Create(
                Mapper.Map <tbl_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 <tbl_Refresh>();
        }
Beispiel #3
0
        public void Repo_Refreshes_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Refreshes.Delete(refresh);
            UoW.Commit();
        }
Beispiel #4
0
        public void Repo_Users_GetV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

            var results = UoW.Users.Get();

            results.Should().BeAssignableTo <IEnumerable <tbl_User> >();
            results.Count().Should().Be(UoW.Users.Count());
        }
Beispiel #5
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();
        }
        public void Repo_TextQueue_GetV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateTexts();

            var results = UoW.TextQueue.Get();

            results.Should().BeAssignableTo <IEnumerable <tbl_TextQueue> >();
            results.Count().Should().Be(UoW.TextQueue.Count());
        }
Beispiel #7
0
        public void Repo_EmailQueue_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateEmails();

            var email = UoW.EmailQueue.Get(QueryExpressionFactory.GetQueryExpression <tbl_EmailQueue>().ToLambda())
                        .First();

            UoW.EmailQueue.Delete(email);
            UoW.Commit();
        }
Beispiel #8
0
        public void Repo_Users_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Users.Delete(user);
            UoW.Commit();
        }
        public void Repo_TextQueue_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateTexts();

            var text = UoW.TextQueue.Get(QueryExpressionFactory.GetQueryExpression <tbl_TextQueue>().ToLambda())
                       .First();

            UoW.TextQueue.Delete(text);
            UoW.Commit();
        }
Beispiel #10
0
        public void Repo_MOTDs_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateMOTDs();

            var MOTD = UoW.MOTDs.Get(QueryExpressionFactory.GetQueryExpression <tbl_MOTD>()
                                     .Where(x => x.Author == TestDefaultConstants.MOTDAuthor).ToLambda())
                       .First();

            UoW.MOTDs.Delete(MOTD);
            UoW.Commit();
        }
Beispiel #11
0
        public void Repo_Claims_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Claims.Delete(claim);
            UoW.Commit();
        }
Beispiel #12
0
        public void Repo_Roles_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

            var role = UoW.Roles.Get(QueryExpressionFactory.GetQueryExpression <tbl_Role>()
                                     .Where(x => x.Name == TestDefaultConstants.RoleName).ToLambda())
                       .Single();

            UoW.Roles.Delete(role);
            UoW.Commit();
        }
Beispiel #13
0
        public void Repo_Logins_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Logins.Delete(login);
            UoW.Commit();
        }
        public void Repo_TextQueue_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateTexts();

            var text = UoW.TextQueue.Get(QueryExpressionFactory.GetQueryExpression <tbl_TextQueue>().ToLambda())
                       .First();

            text.Body += "(Updated)";

            var result = UoW.TextQueue.Update(text);

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_TextQueue>();
        }
Beispiel #15
0
        public void Repo_MOTDs_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateMOTDs();

            var result = UoW.MOTDs.Create(
                Mapper.Map <tbl_MOTD>(new MOTDTssV1
            {
                author = TestDefaultConstants.MOTDAuthor,
                quote  = "Quote-" + Base64.CreateString(4),
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_MOTD>();
        }
Beispiel #16
0
        public void Repo_EmailQueue_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateEmails();

            var email = UoW.EmailQueue.Get(QueryExpressionFactory.GetQueryExpression <tbl_EmailQueue>().ToLambda())
                        .First();

            email.Subject += "(Updated)";

            var result = UoW.EmailQueue.Update(email);

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_EmailQueue>();
        }
Beispiel #17
0
        public void Repo_Logins_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_Login>();
        }
Beispiel #18
0
        public void Repo_Logins_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            login.Name += "(Updated)";

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

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_Login>();
        }
Beispiel #19
0
        public void Repo_Users_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            user.FirstName += "(Updated)";
            user.LastName  += "(Updated)";

            var result = UoW.Users.Update(user);

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_User>();
        }
Beispiel #20
0
        public void Repo_Claims_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            claim.Value += "(Updated)";

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

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_Claim>();
        }
Beispiel #21
0
        public void Repo_MOTDs_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateMOTDs();

            var MOTD = UoW.MOTDs.Get(QueryExpressionFactory.GetQueryExpression <tbl_MOTD>()
                                     .Where(x => x.Author == TestDefaultConstants.MOTDAuthor).ToLambda())
                       .First();

            MOTD.Quote += "(Updated)";

            var result = UoW.MOTDs.Update(MOTD);

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_MOTD>();
        }
Beispiel #22
0
        public void Repo_Roles_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

            var role = UoW.Roles.Get(QueryExpressionFactory.GetQueryExpression <tbl_Role>()
                                     .Where(x => x.Name == TestDefaultConstants.RoleName).ToLambda())
                       .Single();

            role.Name += "(Updated)";

            var result = UoW.Roles.Update(role);

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_Role>();
        }
Beispiel #23
0
        public void Repo_Issuers_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_Issuer>();
        }
Beispiel #24
0
        public void Repo_States_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

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

            state.StateConsume = true;

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

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_State>();
        }
        public void Repo_TextQueue_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateTexts();

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

            var result = UoW.TextQueue.Create(
                Mapper.Map <tbl_TextQueue>(new TextV1()
            {
                FromPhoneNumber = TestDefaultConstants.UserPhoneNumber,
                ToPhoneNumber   = TestDefaultConstants.UserPhoneNumber,
                Body            = "Body-" + Base64.CreateString(32),
                SendAtUtc       = DateTime.UtcNow,
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_TextQueue>();
        }
        public void Repo_Audiences_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

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

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_Audience>();
        }
Beispiel #27
0
        public void Repo_EmailQueue_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

            data.Destroy();
            data.CreateEmails();

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

            var result = UoW.EmailQueue.Create(
                Mapper.Map <tbl_EmailQueue>(new EmailV1()
            {
                FromEmail = user.EmailAddress,
                ToEmail   = user.EmailAddress,
                Subject   = "Subject-" + AlphaNumeric.CreateString(4),
                Body      = "Body" + AlphaNumeric.CreateString(4),
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <tbl_EmailQueue>();
        }
Beispiel #28
0
        public void Repo_Roles_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

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

            UoW.Commit();

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