public void PortTest() { SmartLib.Model.Server target = new SmartLib.Model.Server(); System.UInt16 expected = 8080; target.Port = expected; System.UInt16 actual = target.Port; Assert.AreEqual(expected, actual); }
public void HostnameValidTest() { SmartLib.Model.Server target = new SmartLib.Model.Server(); string expected = "localhost"; target.Hostname = expected; string actual = target.Hostname; Assert.AreEqual(expected, actual); }
public void ServerTest() { ApplicationSettings target = new ApplicationSettings(); SmartLib.Model.Server expected = new SmartLib.Model.Server(); target.Server = expected; SmartLib.Model.Server actual = target.Server; Assert.AreEqual(expected, actual); }
public void SecureTest() { SmartLib.Model.Server target = new SmartLib.Model.Server(); target.Secure = true; Assert.AreEqual(true, target.Secure); target.Secure = false; Assert.AreEqual(false, target.Secure); }
/// <summary> /// /// </summary> /// <param name="args"></param> static void Main( string[] args ) { ShowHeader(); if (args == null || args.GetLength(0) == 0) { ShowHelp(); return; } Controller.CommandLine commandLine = new Controller.CommandLine(args); if (commandLine.GetWantsHelp()) { ShowHelp(); return; } //Connect to server System.String hostname = commandLine.GetHostname(); SmartLib.Model.Server connectionSettings = (hostname == null) ? null : new SmartLib.Model.Server(); if (connectionSettings != null) { connectionSettings.Hostname = hostname; connectionSettings.Port = commandLine.GetPort(); connectionSettings.Secure = commandLine.GetSecure(); } Microsoft.UpdateServices.Administration.IUpdateServer server = SmartLib.Controller.Server.Connect(connectionSettings); //Check user has admin or reporter access Microsoft.UpdateServices.Administration.UpdateServerUserRole role = server.GetCurrentUserRole(); if (role != Microsoft.UpdateServices.Administration.UpdateServerUserRole.Reporter && role != Microsoft.UpdateServices.Administration.UpdateServerUserRole.Administrator) { throw new System.UnauthorizedAccessException("You don't have reporter or administrator access on the WSUS server."); } //Get Classifications System.Console.Out.WriteLine("Getting classifications."); Microsoft.UpdateServices.Administration.UpdateClassificationCollection classifications = SmartLib.Controller.Server.GetUpdateClassifications(server); //Get product categories System.Console.Out.WriteLine("Getting product categories."); Microsoft.UpdateServices.Administration.UpdateCategoryCollection categories = SmartLib.Controller.Server.GetRootUpdateCategories(server); //Get target groups System.Console.Out.WriteLine("Getting root target group."); Microsoft.UpdateServices.Administration.IComputerTargetGroup rootGroup = SmartLib.Controller.Server.GetRootTargetGroup(server); System.Console.Out.WriteLine("\nClassifications:\n"); ListClassifications(classifications); System.Console.Out.WriteLine("\nProduct Categories:\n"); ListCategories(categories, 0); System.Console.Out.WriteLine("\nTarget Groups:\n"); ListTargetGroups(rootGroup); }
public void ServerConstructorTest() { SmartLib.Model.Server target = new SmartLib.Model.Server(); }