Exemple #1
0
        public void GetApplicableDefaultScriptRegTest_EmptyGroups()
        {
            DefaultScriptRegistryFile srFile1 = new DefaultScriptRegistryFile();

            srFile1.ApplyToGroup = "ReallyNotMyGroup";
            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>();

            DefaultScriptRegistryFile actual;

            actual = DefaultScriptHelper.GetApplicableDefaultScriptReg(defaultScriptRegs, groupMemberships);
            Assert.IsNull(actual);
        }
Exemple #2
0
        public void GetApplicableDefaultScriptRegTest_FoundOneMatch_SecondInList()
        {
            DefaultScriptRegistryFile srFile1 = new DefaultScriptRegistryFile();

            srFile1.ApplyToGroup = "MyGroup";
            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(srFile2);
            defaultScriptRegs.Add(srFile1);


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

            DefaultScriptRegistryFile actual;

            actual = DefaultScriptHelper.GetApplicableDefaultScriptReg(defaultScriptRegs, groupMemberships);
            Assert.IsNotNull(actual);
            Assert.IsInstanceOfType(actual, typeof(DefaultScriptRegistryFile));
            Assert.AreEqual(Path.GetFileName(this.fileOne), actual.FileName);
        }
Exemple #3
0
        public void GetApplicableDefaultScriptRegTest_NullRegistry()
        {
            List <DefaultScriptRegistryFile> defaultScriptRegs = null;

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

            DefaultScriptRegistryFile actual;

            actual = DefaultScriptHelper.GetApplicableDefaultScriptReg(defaultScriptRegs, groupMemberships);
            Assert.IsNull(actual);
        }