/// <summary> /// Gets access point info list from the DUT /// </summary> /// <returns></returns> protected List <AccessPointInfo> GetAccessPointInfoList() { Proxies.Onvif.PACSPortClient client = PACSPortClient; AccessControlServiceCapabilities capabilities = null; RunStep(() => { capabilities = client.GetServiceCapabilities(); }, "Get AccessControl service capabilities"); DoRequestDelay(); Assert(capabilities != null, "No Capabilities returned", "Check that the DUT returned service capabilities"); PACS.GetListMethod <AccessPointInfo> getList = new PACS.GetListMethod <AccessPointInfo>( (int?limit, string offset, out AccessPointInfo[] list) => { string newOffset = null; AccessPointInfo[] infos = null; RunStep(() => { newOffset = client.GetAccessPointInfoList(limit, offset, out infos); }, "Get AccessPointInfo list"); list = infos; return(newOffset); }); int maxLimit = capabilities.MaxLimit > 0 ? (int)capabilities.MaxLimit : 1; List <AccessPointInfo> fullList = PACS.Extensions.GetFullList(getList, maxLimit, "AccessPointInfo", Assert); Assert(fullList.Count > 0, "No Access Points returned", "Check that the list of AccessPoint is not empty"); return(fullList); }
public void AccessPointAndDoorInfoConsistencyTest() { RunTest( () => { List <DoorInfo> doors = GetFullDoorInfoList(); // initialize PACSPortClient Proxies.Onvif.PACSPortClient client = PACSPortClient; List <AccessPointInfo> accessPoints = GetAccessPointInfoList(); BeginStep("Validate response received"); List <string> doorTokens = new List <string>(); foreach (AccessPointInfo info in accessPoints) { bool door; // empty type is OK if (info.EntityType == null) { door = true; } else { XmlQualifiedName type = info.EntityType; door = (type.Namespace == OnvifService.DOORCONTROL && type.Name == "Door"); } // it's Door if (door) { if (!doorTokens.Contains(info.Entity)) { doorTokens.Add(info.Entity); } } } StepPassed(); bool ok = true; StringBuilder logger = new StringBuilder(); foreach (string token in doorTokens) { DoorInfo door = doors.Where(D => D.token == token).FirstOrDefault(); if (door == null) { ok = false; logger.AppendFormat("Door with token '{0}' not found{1}", token, Environment.NewLine); } } Assert(ok, logger.ToStringTrimNewLine(), "Check that information is consistent"); }); }