示例#1
0
        public void Repo_EmailQueue_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            var result = UoW.EmailQueue.Create(
                Mapper.Map <uvw_EmailQueue>(new EmailV1()
            {
                FromEmail = user.EmailAddress,
                ToEmail   = user.EmailAddress,
                Subject   = "Subject-" + Base64.CreateString(4),
                Body      = "Body-" + Base64.CreateString(32),
                SendAtUtc = DateTime.UtcNow,
            }));

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_EmailQueue>();
        }
示例#2
0
        public void Repo_Claims_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            var result = UoW.Claims.Create(
                Mapper.Map <uvw_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 <uvw_Claim>();
        }
示例#3
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>();
        }
示例#4
0
        public void Repo_TextQueue_GetV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

            var results = UoW.TextQueue.Get();

            results.Should().BeAssignableTo <IEnumerable <uvw_TextQueue> >();
            results.Count().Should().Be(UoW.TextQueue.Count());
        }
示例#5
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());
        }
示例#6
0
        public void Repo_Claims_GetV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

            var results = UoW.Claims.Get();

            results.Should().BeAssignableTo <IEnumerable <uvw_Claim> >();
            results.Count().Should().Be(UoW.Claims.Count());
        }
示例#7
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();
        }
示例#8
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();
        }
示例#9
0
        public void Repo_TextQueue_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

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

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

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

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

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

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

            UoW.Users.Delete(user);
            UoW.Commit();
        }
示例#12
0
        public void Repo_MOTDs_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.MOTDs.Delete(MOTD);
            UoW.Commit();
        }
示例#13
0
        public void Repo_Audiences_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Audiences.Delete(audience);
            UoW.Commit();
        }
示例#14
0
        public void Repo_Claims_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Claims.Delete(claim);
            UoW.Commit();
        }
示例#15
0
        public void Repo_Logins_DeleteV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Logins.Delete(login);
            UoW.Commit();
        }
示例#16
0
        public void Repo_TextQueue_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            text.Body += "(Updated)";

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_TextQueue>();
        }
示例#17
0
        public void Repo_MOTDs_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_MOTD>();
        }
示例#18
0
        public void Repo_EmailQueue_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            email.Subject += "(Updated)";

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_EmailQueue>();
        }
示例#19
0
        public void Repo_MOTDs_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            MOTD.Quote += "(Updated)";

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_MOTD>();
        }
示例#20
0
        public void Repo_Logins_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            login.Name += "(Updated)";

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_Login>();
        }
示例#21
0
        public void Repo_Logins_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_Login>();
        }
示例#22
0
        public void Repo_Claims_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            claim.Value += "(Updated)";

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_Claim>();
        }
示例#23
0
        public void Repo_Audiences_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            audience.Name += "(Updated)";

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_Audience>();
        }
示例#24
0
        public void Repo_Users_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

            var user = UoW.Users.Get(QueryExpressionFactory.GetQueryExpression <uvw_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 <uvw_User>();
        }
示例#25
0
        public void Repo_Issuers_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_Issuer>();
        }
示例#26
0
        public void Repo_States_UpdateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

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

            state.StateConsume = true;

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_State>();
        }
示例#27
0
        public void Repo_Roles_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_Role>();
        }
示例#28
0
        public void Repo_TextQueue_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

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

            UoW.Commit();

            result.Should().BeAssignableTo <uvw_TextQueue>();
        }
示例#29
0
        public void Repo_Audiences_CreateV1_Success()
        {
            var data = new TestDataFactory(UoW);

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

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

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

            UoW.Commit();

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