public static bool equalAccessProfileInfo(AccessProfileInfo fromGetAccessProfileInfoList, AccessProfileInfo fromGetAccessProfileInfo, StringBuilder logger, string headerFirst = "GetAccessProfileInfoList", string headerSecond = "GetAccessProfileInfo") { bool flag = true; var msgHeader = string.Format("Value of '{{0}}' field is inconsistent. {0}: '{{1}}'. {1}: '{{2}}'.", headerFirst, headerSecond); if (fromGetAccessProfileInfoList.token != fromGetAccessProfileInfo.token) { flag = false; logger.AppendLine(string.Format(msgHeader, "token", fromGetAccessProfileInfoList.token, fromGetAccessProfileInfo.token)); } if (fromGetAccessProfileInfoList.Name != fromGetAccessProfileInfo.Name) { flag = false; logger.AppendLine(string.Format(msgHeader, "Name", fromGetAccessProfileInfoList.Name, fromGetAccessProfileInfo.Name)); } if (fromGetAccessProfileInfoList.Description != fromGetAccessProfileInfo.Description) { flag = false; logger.AppendLine(string.Format(msgHeader, "Description", fromGetAccessProfileInfoList.Description, fromGetAccessProfileInfo.Description)); } return(flag); }
public void ValidateConsistency(AccessProfileInfo initial, AccessProfileInfo received, string commandInitial, string commandReceive) { var logger = new StringBuilder(); logger.AppendLine(string.Format("The AccessProfileInfo item sent in {0} command is inconsistent with received one through {1} command:", commandInitial, commandReceive)); Assert(null != received && equalAccessProfileInfo(initial, received, logger, commandInitial, commandReceive), null == received ? string.Format("The {0} command returned no AccessProfileInfo item", commandReceive) : logger.ToStringTrimNewLine(), "Checking received AccessProfileInfo item"); }
public void ValidateConsistency(AccessProfileInfo initial, IEnumerable <AccessProfileInfo> receivedList, string commandInitial, string commandReceive) { var logger = new StringBuilder(); var twin = receivedList.FirstOrDefault(e => e.token == initial.token); logger.AppendLine(string.Format("The AccessProfileInfo item sent in {0} command is inconsistent with received one through {1} command:", commandInitial, commandReceive)); Assert(null != twin && equalAccessProfileInfo(initial, twin, logger, commandInitial, commandReceive), null == twin ? string.Format("Received AccessProfileInfo list doesn't contain item with token = '{0}'", initial.token) : logger.ToStringTrimNewLine(), "Checking received AccessProfileInfo item"); }