public void SystemInfo_NoPropertiesAreStrings() { GetSystemInfoResponse <DeviceSystemInfo>(SystemInfoItem.SystemItem("1", "2", "3", "4", "5")); GetSystemInfoResponse <DeviceHardwareInfo>(SystemInfoItem.HardwareItem("1", "2", "3", "4", "5", "6", "7", "8")); GetSystemInfoResponse <DeviceSoftwareInfo>(SystemInfoItem.SoftwareItem("1", "2", "3", "\"2017-05-23-00-00-00\"", "5", "6")); GetSystemInfoResponse <DeviceProcessInfo>(SystemInfoItem.ProcessItem("1", "2", "\"2018-08-31 19:36:26\"", "4")); GetSystemInfoResponse <DeviceServiceInfo>(SystemInfoItem.ServiceItem("1", "2", "3", "4", "5")); GetSystemInfoResponse <DeviceUserInfo>(SystemInfoItem.UserItem("1", "2", "3")); }
public void SystemInfo_AllPropertiesAreEmpty() { AssertAllSystemInfoPropertiesDontHaveValues <DeviceSystemInfo>(SystemInfoItem.SystemItem("\"\"", "\"\"", "\"\"", "\"\"", "\"\"")); AssertAllSystemInfoPropertiesDontHaveValues <DeviceHardwareInfo>(SystemInfoItem.HardwareItem("\"\"", "\"\"", "\"\"", "\"\"", "\"\"", "\"\"", "\"\"", "\"\"")); AssertAllSystemInfoPropertiesDontHaveValues <DeviceSoftwareInfo>(SystemInfoItem.SoftwareItem("\"\"", "\"\"", "\"\"", "\"\"", "\"\"", "\"\"")); AssertAllSystemInfoPropertiesDontHaveValues <DeviceProcessInfo>(SystemInfoItem.ProcessItem("\"0\"", "\"\"", "\"\"", "\"\"")); AssertAllSystemInfoPropertiesDontHaveValues <DeviceServiceInfo>(SystemInfoItem.ServiceItem("\"\"", "\"\"", "\"\"", "\"\"", "\"\"", "\"\"")); AssertAllSystemInfoPropertiesDontHaveValues <DeviceUserInfo>(SystemInfoItem.UserItem("\"\"", "\"\"", "\"\"")); }
public void SystemInfo_AllPropertiesAreNull() { AssertAllSystemInfoPropertiesDontHaveValues <DeviceSystemInfo>(SystemInfoItem.SystemItem(null, null, null, null, null)); AssertAllSystemInfoPropertiesDontHaveValues <DeviceHardwareInfo>(SystemInfoItem.HardwareItem(null, null, null, null, null, null, null, null)); AssertAllSystemInfoPropertiesDontHaveValues <DeviceSoftwareInfo>(SystemInfoItem.SoftwareItem(null, null, null, null, null, null)); AssertAllSystemInfoPropertiesDontHaveValues <DeviceProcessInfo>(SystemInfoItem.ProcessItem(null, null, null, null)); AssertAllSystemInfoPropertiesDontHaveValues <DeviceServiceInfo>(SystemInfoItem.ServiceItem(null, null, null, null, null, null)); AssertAllSystemInfoPropertiesDontHaveValues <DeviceUserInfo>(SystemInfoItem.UserItem(null, null, null)); }
private PrtgClient GetFullSummaryClient() { return(GetSystemInfoClient( SystemInfoItem.SystemItem(), SystemInfoItem.SystemItem(), SystemInfoItem.HardwareItem(), SystemInfoItem.HardwareItem(), SystemInfoItem.SoftwareItem(), SystemInfoItem.SoftwareItem(), SystemInfoItem.ProcessItem(), SystemInfoItem.ProcessItem(), SystemInfoItem.ServiceItem(), SystemInfoItem.ServiceItem(), SystemInfoItem.UserItem(), SystemInfoItem.UserItem() )); }
public void SystemInfo_AllPropertiesHaveValues() { AssertAllSystemInfoPropertiesHaveValues <DeviceSystemInfo>(SystemInfoItem.SystemItem(), p => { if (p.Name == "Type") { return(true); } return(false); }); AssertAllSystemInfoPropertiesHaveValues <DeviceHardwareInfo>(SystemInfoItem.HardwareItem(serialNumber: "1234", capacity: "100")); AssertAllSystemInfoPropertiesHaveValues <DeviceSoftwareInfo>(SystemInfoItem.SoftwareItem()); AssertAllSystemInfoPropertiesHaveValues <DeviceProcessInfo>(SystemInfoItem.ProcessItem()); AssertAllSystemInfoPropertiesHaveValues <DeviceServiceInfo>(SystemInfoItem.ServiceItem()); AssertAllSystemInfoPropertiesHaveValues <DeviceUserInfo>(SystemInfoItem.UserItem()); }
public void SystemInfo_Software_PropertiesMapCorrectly() { var name = "\"Name\""; var vendor = "\"Vendor\""; var version = "1.2"; var date = "\"2017-05-23-00-00-00\""; var size = "1234"; var displayName = "\"DisplayName\""; var obj = GetSystemInfoResponse <DeviceSoftwareInfo>( SystemInfoItem.SoftwareItem(name, vendor, version, date, size, displayName) ); AssertAreEqual(name, obj.Name); AssertAreEqual(vendor, obj.Vendor); AssertAreEqual(Version.Parse(version), obj.Version); AssertAreEqual(ParameterHelpers.StringToDate(date.Trim('"')), obj.InstallDate); AssertAreEqual(Convert.ToInt32(size), obj.Size); AssertAreEqual(displayName, obj.DisplayName); }
public void SystemInfo_Software_PropertiesMapCorrectly() { var name = "\"Name\""; var vendor = "\"Vendor\""; var version = "1.2"; var date = "\"2017-05-23-00-00-00\""; var size = "1234"; var receiveTime = "01-02-2003 21:10:13.425"; var displayName = "\"DisplayName\""; var obj = GetSystemInfoResponse <DeviceSoftwareInfo>( SystemInfoItem.SoftwareItem(name, vendor, version, date, size, receiveTime, displayName) ); AssertAreEqual(name, obj.Name); AssertAreEqual(vendor, obj.Vendor); AssertAreEqual(Version.Parse(version), obj.Version); AssertAreEqual(TypeHelpers.StringToDate(date.Trim('"')), obj.InstallDate); AssertAreEqual(Convert.ToInt32(size), obj.Size); AssertAreEqual(DateTime.ParseExact(receiveTime, "dd-MM-yyyy HH:mm:ss.FFF", CultureInfo.InvariantCulture), obj.LastUpdated); AssertAreEqual(displayName, obj.DisplayName); }
private IWebResponse GetTableResponse(string address, string function, bool async) { var components = UrlUtilities.CrackUrl(address); Content?content; try { content = components["content"].DescriptionToEnum <Content>(); } catch { content = null; } var count = GetCount(components, content); //Hack to make test "forces streaming with a date filter and returns no results" work if (content == Content.Logs && count == 0 && components["columns"] == "objid,name") { count = 501; address = address.Replace("count=1", "count=501"); } if (function == nameof(XmlFunction.HistoricData)) { return(new SensorHistoryResponse(GetItems(i => new SensorHistoryItem(), count))); } var columns = components["columns"]?.Split(','); switch (content) { case Content.Sensors: return(Sensors(CreateSensor, count, columns, address, async)); case Content.Devices: return(Devices(CreateDevice, count, columns, address, async)); case Content.Groups: return(Groups(CreateGroup, count, columns, address, async)); case Content.Probes: return(Probes(CreateProbe, count, columns, address, async)); case Content.Logs: if (IsGetTotalLogs(address)) { return(TotalLogsResponse()); } return(Messages(i => new MessageItem($"WMI Remote Ping{i}"), count)); case Content.History: return(new ModificationHistoryResponse(new ModificationHistoryItem())); case Content.Notifications: return(Notifications(CreateNotification, count)); case Content.Schedules: return(Schedules(CreateSchedule, count)); case Content.Channels: return(new ChannelResponse(GetItems(Content.Channels, i => new ChannelItem(), 1))); case Content.Objects: return(Objects(address, function, components)); case Content.Triggers: return(new NotificationTriggerResponse( NotificationTriggerItem.StateTrigger(onNotificationAction: "300|Email to all members of group PRTG Users Group"), NotificationTriggerItem.ThresholdTrigger(onNotificationAction: "300|Email to all members of group PRTG Users Group", offNotificationAction: "300|Email to all members of group PRTG Users Group"), NotificationTriggerItem.SpeedTrigger(onNotificationAction: "300|Email to all members of group PRTG Users Group", offNotificationAction: "300|Email to all members of group PRTG Users Group"), NotificationTriggerItem.VolumeTrigger(onNotificationAction: "300|Email to all members of group PRTG Users Group"), NotificationTriggerItem.ChangeTrigger(onNotificationAction: "300|Email to all members of group PRTG Users Group") )); case Content.SysInfo: return(new SystemInfoResponse( SystemInfoItem.SystemItem(), SystemInfoItem.HardwareItem(), SystemInfoItem.SoftwareItem(), SystemInfoItem.ProcessItem(), SystemInfoItem.ServiceItem(), SystemInfoItem.UserItem() )); default: throw new NotImplementedException($"Unknown content '{content}' requested from {nameof(MultiTypeResponse)}"); } }
public void SystemInfo_Software_Version_MajorNumberOnly() { var obj = GetSystemInfoResponse <DeviceSoftwareInfo>(SystemInfoItem.SoftwareItem(version: "5")); Assert.AreEqual(obj.Version.ToString(), "5.0"); }