public RuleSet Create(RuleSetType type) { return(type switch { RuleSetType.Standard => GetStandardRuleSet(), RuleSetType.EasyReproduction => GetEasyReproductionRuleSet(), _ => throw new Exception() });
public SimulationConfiguration(int maximumGenerations, int animationDelay, GridType gridType, RuleSetType ruleSetType, int height, int width) { MaximumGenerations = maximumGenerations; AnimationDelay = animationDelay; GridType = gridType; RuleSetType = ruleSetType; Height = height; Width = width; }
public void ReturnsExpectedRuleSetForRuleSetTypeEnum(RuleSetType ruleSetType, Type expectedType) { _ruleSetsProvider.GetRuleSets().Returns(new Dictionary <RuleSetType, IRuleSet>() { { RuleSetType.Default, new DefaultRuleSet() }, { RuleSetType.Relaxed, new RelaxedRuleSet() } }); var ruleSetFactory = new RuleSetFactory(_ruleSetsProvider); var ruleSet = ruleSetFactory.GetRuleSet(ruleSetType); ruleSet.ShouldBeOfType(expectedType); }
public string GetSummary(RuleSetType ruleSetType) { var scheduledFlightSummary = _summaryBuilder.BuildSummary(FlightRoute, Aircraft, Passengers); var scheduledFlightContext = new ScheduledFlightContext() { Aircraft = Aircraft, FlightRoute = FlightRoute, RuleSetType = ruleSetType, ScheduledFlightSummary = scheduledFlightSummary }; return(_summaryOutputGenerator.GenerateOutput(scheduledFlightContext)); }
/// <summary> /// Use this call to retrieve a list of rules of a given type /// </summary> /// <param name="type">The rule type.</param> /// <returns>A list of rules of the requested type</returns> public List <RuleHeaderBasic> GetRulesByType(RuleSetType type) { var response = GetResponse("RulesEngine/GetRulesByType", "type=" + type.ToString() + "", "POST"); return(JsonFormatter.ConvertFromJson <List <RuleHeaderBasic> >(response)); }
public static RuleHeaderBasic CreateNewDraft(String ruleName, RuleSetType type, Guid ApiToken, String ApiServer) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <RuleHeaderBasic>(Factory.GetResponse("RulesEngine/CreateNewDraft", "ruleName=" + ruleName + "&type=" + type + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); }
public static List <String> GetOptions(String fieldName, RuleSetType type, String key, Guid ApiToken, String ApiServer) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <List <String> >(Factory.GetResponse("RulesEngine/GetOptions", "fieldName=" + fieldName + "&type=" + type + "&key=" + key + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); }
public static List<MultiKeyOptionResponse> GetMultiKeyOptions(RuleSetType type, List<String> fieldNames, String ApiToken, String ApiServer) { return Newtonsoft.Json.JsonConvert.DeserializeObject<List<MultiKeyOptionResponse>>(Factory.GetResponse("RulesEngine/GetMultiKeyOptions", "type=" + Newtonsoft.Json.JsonConvert.SerializeObject(type) + "&fieldNames=" + Newtonsoft.Json.JsonConvert.SerializeObject(fieldNames) + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); }
public static RuleHeaderBasic CreateNewDraft(String ruleName, RuleSetType type, String ApiToken, String ApiServer) { return Newtonsoft.Json.JsonConvert.DeserializeObject<RuleHeaderBasic>(Factory.GetResponse("RulesEngine/CreateNewDraft", "ruleName=" + ruleName + "&type=" + Newtonsoft.Json.JsonConvert.SerializeObject(type) + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); }
public static List <RuleHeaderBasic> GetRulesByType(RuleSetType type, String ApiToken, String ApiServer) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <List <RuleHeaderBasic> >(Factory.GetResponse("RulesEngine/GetRulesByType", "type=" + Newtonsoft.Json.JsonConvert.SerializeObject(type, serializerSettings) + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); }
public static List <FieldDescriptor> GetEvaluationFields(RuleSetType type, String ApiToken, String ApiServer) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <List <FieldDescriptor> >(Factory.GetResponse("RulesEngine/GetEvaluationFields", "type=" + Newtonsoft.Json.JsonConvert.SerializeObject(type, serializerSettings) + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); }
public ScheduledFlightContext() { RuleSetType = RuleSetType.Default; }
/// <summary> /// Use this call to retrieve a list of valid action types for the rule type /// </summary> /// <param name="type">The rule type.</param> /// <returns>Valid action types</returns> public List <ActionTypeDescriptor> GetActionTypes(RuleSetType type) { var response = GetResponse("RulesEngine/GetActionTypes", "type=" + type.ToString() + ""); return(JsonFormatter.ConvertFromJson <List <ActionTypeDescriptor> >(response)); }
/// <summary> /// Use this call to get a list of valid options for a given set of fields (and, if relevant, keys). /// </summary> /// <param name="type">The rule type.</param> /// <param name="fieldKeys">A list of fields and optionally keys.</param> /// <returns>A list of valid options grouped by Field/Key</returns> public List <MultiOptionResponse> GetMultiOptions(RuleSetType type, List <FieldKeys> fieldKeys) { var response = GetResponse("RulesEngine/GetMultiOptions", "type=" + type.ToString() + "&fieldKeys=" + JsonFormatter.ConvertToJson(fieldKeys) + ""); return(JsonFormatter.ConvertFromJson <List <MultiOptionResponse> >(response)); }
public IRuleSet GetRuleSet(RuleSetType ruleSetType) { return(_ruleSets[ruleSetType]); }
public static List<String> GetOptions(String fieldName, RuleSetType type, String key, String ApiToken, String ApiServer) { return Newtonsoft.Json.JsonConvert.DeserializeObject<List<String>>(Factory.GetResponse("RulesEngine/GetOptions", "fieldName=" + fieldName + "&type=" + Newtonsoft.Json.JsonConvert.SerializeObject(type) + "&key=" + key + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); }
public static List<RuleHeaderBasic> GetRulesByType(RuleSetType type, String ApiToken, String ApiServer) { return Newtonsoft.Json.JsonConvert.DeserializeObject<List<RuleHeaderBasic>>(Factory.GetResponse("RulesEngine/GetRulesByType", "type=" + Newtonsoft.Json.JsonConvert.SerializeObject(type) + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); }
/// <summary> /// Use this call to create a new draft rule of a specified type. /// </summary> /// <param name="ruleName">The name for the new draft.</param> /// <param name="type">The rule type.</param> /// <returns>The rule header.</returns> public RuleHeaderBasic CreateNewDraft(String ruleName, RuleSetType type) { var response = GetResponse("RulesEngine/CreateNewDraft", "ruleName=" + System.Net.WebUtility.UrlEncode(ruleName) + "&type=" + type.ToString() + "", "POST"); return(JsonFormatter.ConvertFromJson <RuleHeaderBasic>(response)); }
public static List<FieldDescriptor> GetEvaluationFields(RuleSetType type, String ApiToken, String ApiServer) { return Newtonsoft.Json.JsonConvert.DeserializeObject<List<FieldDescriptor>>(Factory.GetResponse("RulesEngine/GetEvaluationFields", "type=" + Newtonsoft.Json.JsonConvert.SerializeObject(type) + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); }
/// <summary> /// Use this call to get a list of valid evaluation fields for a given rule type. /// </summary> /// <param name="type">The rule type.</param> /// <returns>Returns a list of evaluation available fields.</returns> public List <FieldDescriptor> GetEvaluationFields(RuleSetType type) { var response = GetResponse("RulesEngine/GetEvaluationFields", "type=" + type.ToString() + "", "POST"); return(JsonFormatter.ConvertFromJson <List <FieldDescriptor> >(response)); }
public static List <MultiOptionResponse> GetMultiOptions(RuleSetType type, List <FieldKeys> fieldKeys, Guid ApiToken, String ApiServer) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <List <MultiOptionResponse> >(Factory.GetResponse("RulesEngine/GetMultiOptions", "type=" + type + "&fieldKeys=" + Newtonsoft.Json.JsonConvert.SerializeObject(fieldKeys, serializerSettings) + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); }
/// <summary> /// Use this call to get a list of valid options for a given set of fields (and, if relevant, keys). /// </summary> /// <param name="type">The rule type.</param> /// <param name="fieldKeys">A list of fields and optionally keys.</param> /// <returns>A list of valid options grouped by Field/Key</returns> public List <MultiOptionResponse> GetMultiOptions(RuleSetType type, List <FieldKeys> fieldKeys) { var response = GetResponse("RulesEngine/GetMultiOptions", "type=" + type.ToString() + "&fieldKeys=" + System.Net.WebUtility.UrlEncode(JsonFormatter.ConvertToJson(fieldKeys)) + "", "POST"); return(JsonFormatter.ConvertFromJson <List <MultiOptionResponse> >(response)); }
public static RulesFields GetRequiredFieldsByType(RuleSetType type, Guid ApiToken, String ApiServer) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <RulesFields>(Factory.GetResponse("RulesEngine/GetRequiredFieldsByType", "type=" + type + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); }
/// <summary> /// Use this call to get a list of valid options for a given field (and, if relevant, key). /// </summary> /// <param name="fieldName">The field name.</param> /// <param name="type">The rule type.</param> /// <param name="key">The key (optional).</param> /// <returns>Returns a list of options.</returns> public List <String> GetOptions(String fieldName, RuleSetType type, String key) { var response = GetResponse("RulesEngine/GetOptions", "fieldName=" + System.Net.WebUtility.UrlEncode(fieldName) + "&type=" + type.ToString() + "&key=" + System.Net.WebUtility.UrlEncode(key) + "", "POST"); return(JsonFormatter.ConvertFromJson <List <String> >(response)); }
public static List <ActionTypeDescriptor> GetActionTypes(RuleSetType type, Guid ApiToken, String ApiServer) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <List <ActionTypeDescriptor> >(Factory.GetResponse("RulesEngine/GetActionTypes", "type=" + type + "", ApiToken, ApiServer), new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore })); }
/// <summary> /// Use this call to get a list of fields and keys used by a given rule type /// </summary> /// <param name="type">The rule type.</param> /// <returns>A object containing a list of fields for enabled rules</returns> public RulesFields GetRequiredFieldsByType(RuleSetType type) { var response = GetResponse("RulesEngine/GetRequiredFieldsByType", "type=" + type.ToString() + "", "POST"); return(JsonFormatter.ConvertFromJson <RulesFields>(response)); }