예제 #1
0
    public void RunBeforeAnyTestsInThisAssembly()
    {
        var dbInitialiser = new DatabaseInitialiser();

        //control db initialisation and seeding through these two bools
        var shouldDropCreateDB = true;

        if (shouldDropCreateDB)
        {
            dbInitialiser.Publish(true);

            var seedScripts = new string[]
            {
                AppDomain.CurrentDomain.BaseDirectory + "\\Scripts\\InsertContactPreferenceType.sql",
                AppDomain.CurrentDomain.BaseDirectory + "\\Scripts\\InsertPersonType.sql",
                AppDomain.CurrentDomain.BaseDirectory + "\\Scripts\\InsertPersonTitleType.sql",
                AppDomain.CurrentDomain.BaseDirectory + "\\Scripts\\InsertPerson.sql",
                AppDomain.CurrentDomain.BaseDirectory + "\\Scripts\\InsertEmployerContact.sql",
                AppDomain.CurrentDomain.BaseDirectory + "\\Scripts\\InsertEmployer.sql",
                AppDomain.CurrentDomain.BaseDirectory + "\\Scripts\\InsertVacancyProvisionRelationshipStatusType.sql",
                AppDomain.CurrentDomain.BaseDirectory + "\\Scripts\\InsertVacancyOwnerRelationship.sql"
            };
            dbInitialiser.Seed(seedScripts);

            //dbInitialiser.Seed(SeedData.Providers);
            dbInitialiser.Seed(SeedData.ProviderUsers);
            dbInitialiser.Seed(SeedData.AgencyUsers);
            //dbInitialiser.Seed(SeedData.Vacancies());
        }
    }
        public void RunBeforeAnyTestsInThisAssembly()
        {
            var dbInitialiser = new DatabaseInitialiser();

            // ReSharper disable once ConvertToConstant.Local
            var shouldDropAndCreateDatabase = true;

            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            if (!shouldDropAndCreateDatabase)
            {
                return;
            }

            dbInitialiser.Publish(true);

            var scriptsBasePath = AppDomain.CurrentDomain.BaseDirectory + @"\Scripts\";

            var scriptFilePaths = new[]
            {
                scriptsBasePath + "InsertPerson.sql",
                scriptsBasePath + "InsertEmployerContact.sql",
                scriptsBasePath + "InsertEmployer.sql",
                scriptsBasePath + "InsertProvider.sql",
                scriptsBasePath + "InsertVacancyOwnerRelationship.sql",
                scriptsBasePath + "InsertAgencyUser.sql",
                scriptsBasePath + "InsertProviderUser.sql"
            };

            dbInitialiser.Seed(scriptFilePaths);
        }