protected void InitialiseTestObjects()
 {
     _service = new EFRepositoryPermissionService
     {
         CreateContext = () => _connection.GetContext(),
         Repository    = new EFRepositoryRepository {
             CreateContext = () => _connection.GetContext()
         }
     };
     new AutomaticUpdater().RunWithContext(_connection.GetContext());
 }
        protected void InitialiseTestObjects()
        {
            _teams = new EFTeamRepository {
                CreateContext = () => _connection.GetContext()
            };
            _users = new EFMembershipService {
                CreateContext = () => _connection.GetContext()
            };
            _repos = new EFRepositoryRepository {
                CreateContext = () => _connection.GetContext()
            };
            _roles = new EFRoleProvider {
                CreateContext = () => _connection.GetContext()
            };

            _service = new RepositoryPermissionService
            {
                Repository     = _repos,
                TeamRepository = _teams,
                RoleProvider   = _roles
            };

            new AutomaticUpdater().RunWithContext(_connection.GetContext());
        }
Example #3
0
 private BonoboGitServerContext GetContext()
 {
     return(_connection.GetContext());
 }
Example #4
0
        public void RunUpdateOn_v1_2_0_25ddf80()
        {
            _connection.GetContext().Database.ExecuteSqlCommand(@"

                    CREATE TABLE IF NOT EXISTS [Repository] (
                        [Name] VarChar(255) Not Null,
                        [Description] VarChar(255) Null,
                        [Anonymous] Bit Not Null,
                        Constraint [PK_Repository] Primary Key ([Name])
                    );

                    CREATE TABLE IF NOT EXISTS [Role] (
                        [Name] VarChar(255) Not Null,
                        [Description] VarChar(255) Null,
                        Constraint [PK_Role] Primary Key ([Name])
                    );

                    CREATE TABLE IF NOT EXISTS [Team] (
                        [Name] VarChar(255) Not Null,
                        [Description] VarChar(255) Null,
                        Constraint [PK_Team] Primary Key ([Name])
                    );

                    CREATE TABLE IF NOT EXISTS [User] (
                        [Name] VarChar(255) Not Null,
                        [Surname] VarChar(255) Not Null,
                        [Username] VarChar(255) Not Null,
                        [Password] VarChar(255) Not Null,
                        [Email] VarChar(255) Not Null,
                        Constraint [PK_User] Primary Key ([Username])
                    );

                    CREATE TABLE IF NOT EXISTS [TeamRepository_Permission] (
                        [Team_Name] VarChar(255) Not Null,
                        [Repository_Name] VarChar(255) Not Null,
                        Constraint [UNQ_TeamRepository_Permission_1] Unique ([Team_Name], [Repository_Name]),
                        Foreign Key ([Team_Name]) References [Team]([Name]),
                        Foreign Key ([Repository_Name]) References [Repository]([Name])
                    );

                    CREATE TABLE IF NOT EXISTS [UserRepository_Administrator] (
                        [User_Username] VarChar(255) Not Null,
                        [Repository_Name] VarChar(255) Not Null,
                        Constraint [UNQ_UserRepository_Administrator_1] Unique ([User_Username], [Repository_Name]),
                        Foreign Key ([User_Username]) References [User]([Username]),
                        Foreign Key ([Repository_Name]) References [Repository]([Name])
                    );

                    CREATE TABLE IF NOT EXISTS [UserRepository_Permission] (
                        [User_Username] VarChar(255) Not Null,
                        [Repository_Name] VarChar(255) Not Null,
                        Constraint [UNQ_UserRepository_Permission_1] Unique ([User_Username], [Repository_Name]),
                        Foreign Key ([User_Username]) References [User]([Username]),
                        Foreign Key ([Repository_Name]) References [Repository]([Name])
                    );

                    CREATE TABLE IF NOT EXISTS [UserRole_InRole] (
                        [User_Username] VarChar(255) Not Null,
                        [Role_Name] VarChar(255) Not Null,
                        Constraint [UNQ_UserRole_InRole_1] Unique ([User_Username], [Role_Name]),
                        Foreign Key ([User_Username]) References [User]([Username]),
                        Foreign Key ([Role_Name]) References [Role]([Name])
                    );

                    CREATE TABLE IF NOT EXISTS [UserTeam_Member] (
                        [User_Username] VarChar(255) Not Null,
                        [Team_Name] VarChar(255) Not Null,
                        Constraint [UNQ_UserTeam_Member_1] Unique ([User_Username], [Team_Name]),
                        Foreign Key ([User_Username]) References [User]([Username]),
                        Foreign Key ([Team_Name]) References [Team]([Name])
                    );
                  
                    ");
            new AutomaticUpdater().RunWithContext(_connection.GetContext());
        }
Example #5
0
        public void RunUpdateOn_2_1_96fa2a()
        {
            _connection.GetContext().Database.ExecuteSqlCommand(@"
                IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND  TABLE_NAME = 'Repository'))
                    BEGIN
                        CREATE TABLE [Repository] (
                            [Name] VarChar(255) Not Null,
                            [Description] VarChar(255) Null,
                            [Anonymous] Bit Not Null,
                            Constraint [PK_Repository] Primary Key ([Name])
                        );
                    END

                    IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND  TABLE_NAME = 'Role'))
                    BEGIN
                        CREATE TABLE [Role] (
                            [Name] VarChar(255) Not Null,
                            [Description] VarChar(255) Null,
                            Constraint [PK_Role] Primary Key ([Name])
                        );
                    END

                    IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND  TABLE_NAME = 'Team'))
                    BEGIN
                        CREATE TABLE [Team] (
                            [Name] VarChar(255) Not Null,
                            [Description] VarChar(255) Null,
                            Constraint [PK_Team] Primary Key ([Name])
                        );
                    END

                    IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND  TABLE_NAME = 'User'))
                    BEGIN
                        CREATE TABLE [User] (
                            [Name] VarChar(255) Not Null,
                            [Surname] VarChar(255) Not Null,
                            [Username] VarChar(255) Not Null,
                            [Password] VarChar(255) Not Null,
                            [Email] VarChar(255) Not Null,
                            Constraint [PK_User] Primary Key ([Username])
                        );
                    END

                    IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND  TABLE_NAME = 'TeamRepository_Permission'))
                    BEGIN
                        CREATE TABLE [TeamRepository_Permission] (
                            [Team_Name] VarChar(255) Not Null,
                            [Repository_Name] VarChar(255) Not Null,
                            Constraint [UNQ_TeamRepository_Permission_1] Unique ([Team_Name], [Repository_Name]),
                            Foreign Key ([Team_Name]) References [Team]([Name]),
                            Foreign Key ([Repository_Name]) References [Repository]([Name])
                        );
                    END

                    IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND  TABLE_NAME = 'UserRepository_Administrator'))
                    BEGIN
                        CREATE TABLE [UserRepository_Administrator] (
                            [User_Username] VarChar(255) Not Null,
                            [Repository_Name] VarChar(255) Not Null,
                            Constraint [UNQ_UserRepository_Administrator_1] Unique ([User_Username], [Repository_Name]),
                            Foreign Key ([User_Username]) References [User]([Username]),
                            Foreign Key ([Repository_Name]) References [Repository]([Name])
                        );
                    END

                    IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND  TABLE_NAME = 'UserRepository_Permission'))
                    BEGIN
                        CREATE TABLE [UserRepository_Permission] (
                            [User_Username] VarChar(255) Not Null,
                            [Repository_Name] VarChar(255) Not Null,
                            Constraint [UNQ_UserRepository_Permission_1] Unique ([User_Username], [Repository_Name]),
                            Foreign Key ([User_Username]) References [User]([Username]),
                            Foreign Key ([Repository_Name]) References [Repository]([Name])
                        );
                    END

                    IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND  TABLE_NAME = 'UserRole_InRole'))
                    BEGIN
                        CREATE TABLE [UserRole_InRole] (
                            [User_Username] VarChar(255) Not Null,
                            [Role_Name] VarChar(255) Not Null,
                            Constraint [UNQ_UserRole_InRole_1] Unique ([User_Username], [Role_Name]),
                            Foreign Key ([User_Username]) References [User]([Username]),
                            Foreign Key ([Role_Name]) References [Role]([Name])
                        );
                    END

                    IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND  TABLE_NAME = 'UserTeam_Member'))
                    BEGIN
                        CREATE TABLE [UserTeam_Member] (
                            [User_Username] VarChar(255) Not Null,
                            [Team_Name] VarChar(255) Not Null,
                            Constraint [UNQ_UserTeam_Member_1] Unique ([User_Username], [Team_Name]),
                            Foreign Key ([User_Username]) References [User]([Username]),
                            Foreign Key ([Team_Name]) References [Team]([Name])
                        );
                    END
                ");
        }
Example #6
0
 protected void InitialiseTestObjects()
 {
     _repo = new EFTeamRepository(() => _connection.GetContext());
     _membershipService = new EFMembershipService(() => _connection.GetContext());
     new AutomaticUpdater().RunWithContext(_connection.GetContext(), Substitute.For <IAuthenticationProvider>());
 }