public void PackageSbxFileIntoSbmFileTest_Success()
        {
            string folder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            Directory.CreateDirectory(folder);

            string sbxFile = Path.Combine(folder, "sbx_package_tester.sbx");
            string script1 = Path.Combine(folder, "CreateTestTablesScript.sql");
            string script2 = Path.Combine(folder, "LoggingTable.sql");

            File.WriteAllBytes(sbxFile, Properties.Resources.sbx_package_tester);
            File.WriteAllText(script1, Properties.Resources.CreateTestTablesScript);
            File.WriteAllText(script2, Properties.Resources.LoggingTable);


            string sbmProjectFileName = Path.Combine(folder, "test.sbm");
            bool   expected           = true;
            bool   actual;

            actual = SqlBuildFileHelper.PackageSbxFileIntoSbmFile(sbxFile, sbmProjectFileName);

            Directory.Delete(folder, true);

            Assert.AreEqual(expected, actual);
        }
        public void PackageSbxFileIntoSbmFileTest_EmptySbxName()
        {
            string sbxBuildControlFileName = string.Empty;
            string sbmProjectFileName      = @"C:\test.sbm";
            bool   expected = false;
            bool   actual;

            actual = SqlBuildFileHelper.PackageSbxFileIntoSbmFile(sbxBuildControlFileName, sbmProjectFileName);
            Assert.AreEqual(expected, actual);
        }
        public void PackageSbxFileIntoSbmFileTest_PreExistingSbmFile()
        {
            string sbxBuildControlFileName = Path.GetTempFileName();
            string sbmProjectFileName      = @"C:\test.sbm";
            bool   expected = false;
            bool   actual;

            actual = SqlBuildFileHelper.PackageSbxFileIntoSbmFile(sbxBuildControlFileName, sbmProjectFileName);

            if (File.Exists(sbxBuildControlFileName))
            {
                File.Delete(sbmProjectFileName);
            }

            Assert.AreEqual(expected, actual);
        }
        public void PackageSbxFileIntoSbmFileTest_DontPassSbmName_Fail()
        {
            string folder = Path.GetTempPath() + Guid.NewGuid().ToString();

            Directory.CreateDirectory(folder);

            string sbxBuildControlFileName = Path.Combine(folder, "sbx_package_tester.sbx");

            File.WriteAllBytes(sbxBuildControlFileName, Properties.Resources.sbx_package_tester);

            string expected = string.Empty;
            string actual;

            actual = SqlBuildFileHelper.PackageSbxFileIntoSbmFile(sbxBuildControlFileName);
            Directory.Delete(folder, true);

            Assert.AreEqual(expected, actual);
        }
        public void PackageSbxFileIntoSbmFileTest_GoodSbxNoScripts()
        {
            string folder = Path.GetTempPath() + Guid.NewGuid().ToString();

            Directory.CreateDirectory(folder);

            string sbxFile = Path.Combine(folder, "sbx_package_tester.sbx");

            File.WriteAllBytes(sbxFile, Properties.Resources.sbx_package_tester);


            string sbmProjectFileName = Path.Combine(folder, @"test.sbm");
            bool   expected           = false;
            bool   actual;

            actual = SqlBuildFileHelper.PackageSbxFileIntoSbmFile(sbxFile, sbmProjectFileName);

            Directory.Delete(folder, true);

            Assert.AreEqual(expected, actual);
        }
        public void PackageSbxFileIntoSbmFileTest_DontPassSbmName_Success()
        {
            string folder = Path.GetTempPath() + Guid.NewGuid().ToString();

            Directory.CreateDirectory(folder);

            string sbxBuildControlFileName = Path.Combine(folder, "sbx_package_tester.sbx");
            string script1 = Path.Combine(folder, "CreateTestTablesScript.sql");
            string script2 = Path.Combine(folder, "LoggingTable.sql");

            File.WriteAllBytes(sbxBuildControlFileName, Properties.Resources.sbx_package_tester);
            File.WriteAllText(script1, Properties.Resources.CreateTestTablesScript);
            File.WriteAllText(script2, Properties.Resources.LoggingTable);

            string expected = Path.Combine(Path.GetDirectoryName(sbxBuildControlFileName), Path.GetFileNameWithoutExtension(sbxBuildControlFileName) + ".sbm");
            string actual;

            actual = SqlBuildFileHelper.PackageSbxFileIntoSbmFile(sbxBuildControlFileName);
            Directory.Delete(folder, true);

            Assert.AreEqual(expected, actual);
        }