internal static void _Tests(cTrace.cContext pParentContext) { bool lFailed; var lFlags = new cStorableFlagList(); lFlags.Add("a"); lFlags.Add("b"); lFlags.Add(kMessageFlag.Answered, kMessageFlag.Deleted); lFlags.Add(kMessageFlag.Answered, kMessageFlag.Deleted, kMessageFlag.Forwarded); lFlags.Add(@"\answereD"); lFlags.Add(@"\ansWereD", "A", @"\deleteD"); lFailed = false; try { lFlags.Add("fr ed"); } catch { lFailed = true; } if (!lFailed) { throw new cTestsException($"{nameof(cStorableFlagList)}.1"); } lFailed = false; try { lFlags.Add(kMessageFlag.Answered, kMessageFlag.Deleted, kMessageFlag.Draft, kMessageFlag.Recent); } catch { lFailed = true; } if (!lFailed) { throw new cTestsException($"{nameof(cStorableFlagList)}.1"); } if (lFlags.Count != 5) { throw new cTestsException($"{nameof(cStorableFlagList)}.2"); } if (!lFlags.Contains("A") || !lFlags.Contains("B") || !lFlags.Contains(@"\aNswereD") || lFlags.Contains(kMessageFlag.Draft) || !lFlags.Contains("$forwarded")) { throw new cTestsException($"{nameof(cStorableFlagList)}.3"); } cStorableFlags lF1 = new cStorableFlags("a", "A", "b", @"\answered", "\\deleted", kMessageFlag.Forwarded); cFetchableFlags lF2 = new cFetchableFlags("a", "A", "b", @"\answered", "\\deleted", kMessageFlag.Recent); cStorableFlags lF3 = new cStorableFlags("a", "b", "\\deleted", kMessageFlag.Forwarded); if (!lFlags.Contains(lF1) || lFlags.Contains(lF2) || !lFlags.Contains(lF3)) { throw new cTestsException($"{nameof(cStorableFlagList)}.4"); } lFlags.Remove("A"); if (lFlags.Count != 4 || lFlags.Contains(lF1) || lFlags.Contains(lF3)) { throw new cTestsException($"{nameof(cStorableFlagList)}.5"); } lFlags.Remove("B", "$forwarded", @"\answered"); if (lFlags.Count != 1 || lFlags.Contains(lF3)) { throw new cTestsException($"{nameof(cStorableFlagList)}.6"); } }
/// <inheritdoc cref="cStorableFlags(cStorableFlagList)"/> public cStorableFlagList(cStorableFlagList pFlags) : base(new List <string>(pFlags)) { }
/// <summary> /// Initialises a new instance with a copy of the specified list. /// </summary> /// <param name="pFlags"></param> public cStorableFlags(cStorableFlagList pFlags) : base(pFlags) { }