public static IEnumerable <string> GetRequestedArguments(this string name, ArgumentRequest request) { if (request.ContainsAny(Letter)) { yield return($"{name[0]}"); } if (request.ContainsAny(Full)) { yield return($"{name}"); } }
public void AllRequestsValidTest() { IRequest r1 = new AddRequest(); IRequest r2 = new CheckOutRequest(); IRequest r3 = new ArgumentRequest("blah"); _cmdbase.ValidRequestTypes = new List<RequestType> { RequestType.Add, RequestType.CheckOut, RequestType.CheckIn, RequestType.Modified, RequestType.Argument, RequestType.Update }; _cmdbase.Requests = new List<IRequest> { r1, r2, r3 }; bool result = _cmdbase.AllRequestsAreValid(); Assert.IsTrue(result); IRequest r4 = new UpdatePatchesRequest(); _cmdbase.Requests.Add(r4); Assert.IsFalse(_cmdbase.AllRequestsAreValid()); }
public static bool ContainedBy(this ArgumentRequest value, ArgumentRequest mask) => (mask & value) != None;
public static bool ContainsAll(this ArgumentRequest value, params ArgumentRequest[] values) => values.Aggregate(None, (g, x) => g | x).ContainedBy(value);
public static bool ContainsAny(this ArgumentRequest value, params ArgumentRequest[] values) => values.Any(x => x.ContainedBy(value));
internal IRequest GetExportTypeRequest() { string arg; if (ExportType == ExportType.Date) arg = string.Format("-D {0}", ExportDate.ToRfc822()); else arg = string.Format("-r {0}", Tag); IRequest exportRequest = new ArgumentRequest(arg); return exportRequest; }