예제 #1
0
        public void SetEnterpriseDefaultScriptsTest_NoItemsScriptRegistryFile()
        {
            SqlSync.SqlBuild.SqlBuildFileHelper.DefaultScriptXmlFile = this.fileThree;

            DefaultScriptRegistryFile srFile1 = new DefaultScriptRegistryFile();

            srFile1.ApplyToGroup = "MyGroup";
            File.WriteAllText(this.fileOne, "<?xml version=\"1.0\" encoding=\"utf-8\" ?><DefaultScriptRegistry xmlns=\"http://schemas.mckechney.com/DefaultScriptRegistry.xsd\"></DefaultScriptRegistry>");


            srFile1.FileName = Path.GetFileName(this.fileOne);
            srFile1.Path     = Path.GetDirectoryName(this.fileOne);

            DefaultScriptRegistryFile srFile2 = new DefaultScriptRegistryFile();

            srFile2.ApplyToGroup = "NotMyGroup";
            srFile2.FileName     = Path.GetFileName(this.fileTwo);
            srFile2.Path         = Path.GetDirectoryName(this.fileTwo);

            List <DefaultScriptRegistryFile> defaultScriptRegs = new List <DefaultScriptRegistryFile>();

            defaultScriptRegs.Add(srFile1);
            defaultScriptRegs.Add(srFile2);

            List <string> groupMemberships = new List <string>(new string[] { "Group1", "Group2", "MyGroup" });
            bool          expected         = false;
            bool          actual;

            actual = DefaultScriptHelper.SetEnterpriseDefaultScripts(defaultScriptRegs, groupMemberships);
            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void SetEnterpriseDefaultScriptsTest_NoMatchingScriptRegistryFile()
        {
            SqlSync.SqlBuild.SqlBuildFileHelper.DefaultScriptXmlFile = this.fileThree;

            DefaultScriptRegistryFile srFile1 = new DefaultScriptRegistryFile();

            srFile1.ApplyToGroup = "ReallyNotMyGroup";
            File.WriteAllText(this.fileOne, String.Format(Properties.Resources.DefaultScriptRegistryWithToken, this.fileOne));
            srFile1.FileName = Path.GetFileName(this.fileOne);
            srFile1.Path     = Path.GetDirectoryName(this.fileOne);

            DefaultScriptRegistryFile srFile2 = new DefaultScriptRegistryFile();

            srFile2.ApplyToGroup = "NotMyGroup";
            srFile2.FileName     = Path.GetFileName(this.fileTwo);
            srFile2.Path         = Path.GetDirectoryName(this.fileTwo);

            List <DefaultScriptRegistryFile> defaultScriptRegs = new List <DefaultScriptRegistryFile>();

            defaultScriptRegs.Add(srFile1);
            defaultScriptRegs.Add(srFile2);

            List <string> groupMemberships = new List <string>(new string[] { "Group1", "Group2", "MyGroup" });
            bool          expected         = false;
            bool          actual;

            actual = DefaultScriptHelper.SetEnterpriseDefaultScripts(defaultScriptRegs, groupMemberships);
            Assert.AreEqual(expected, actual);
        }