예제 #1
0
 public void ClassificationsTest()
 {
     TargetGroup target = new TargetGroup();
     ClassificationCollection expected = new ClassificationCollection();
     target.Classifications = expected;
     ClassificationCollection actual = target.Classifications;
     Assert.AreEqual(expected, actual);
 }
예제 #2
0
 public void GuidTest()
 {
     TargetGroup target = new TargetGroup(); // TODO: Initialize to an appropriate value
     Guid expected = Guid.NewGuid();
     target.Guid = expected;
     Guid actual = target.Guid;
     Assert.AreEqual(expected, actual);
 }
예제 #3
0
        /// <summary>
        /// The do run set target group.
        /// </summary>
        /// <param name="server">
        /// Object representing the WSUS server
        /// </param>
        /// <param name="targetGroup">
        /// </param>
        /// <param name="isTest">
        /// Whether we are in test mode
        /// </param>
        /// <param name="alreadyProcessed">
        /// List of target groups that have already been processed
        /// </param>
        private static void DoRunSetTargetGroup(
            IUpdateServer server,
            TargetGroup targetGroup,
            bool isTest,
            List<IComputerTargetGroup> alreadyProcessed)
        {
            Console.WriteLine("Processing Target Groups: " + targetGroup.Guid);

            // check the target group exists on wsus
            IComputerTargetGroup ctg = server.GetComputerTargetGroup(targetGroup.Guid);

            Console.WriteLine("Matched target group guid to: " + ctg.Name);

            // Get classifications
            if (targetGroup.Classifications.ElementInformation.IsPresent)
            {
                Console.WriteLine("Found a collection of specific classifications to apply.");
                DoRunSetClassifications(server, ctg, targetGroup.Classifications, isTest, alreadyProcessed);
            }
            else if (targetGroup.AllClassifications.ElementInformation.IsPresent)
            {
                Console.WriteLine("Applying all classifications.");
                DoRunSetAllClassifications(server, ctg, isTest, targetGroup.AllClassifications);
            }
            else
            {
                throw new ConfigurationErrorsException(
                    "Unable to detect if we are running a specific set of classifications, or processing all classifications");
            }
        }
예제 #4
0
 public void TargetGroupConstructorTest()
 {
     TargetGroup target = new TargetGroup();
 }
        public void ItemTest()
        {
            TargetGroupCollection target = new TargetGroupCollection(); // TODO: Initialize to an appropriate value

            int index = 0;
            TargetGroup expected = new TargetGroup();
            target.Add(expected);
            TargetGroup actual = target[index];
            Assert.AreEqual(expected, actual);
        }