private Dictionary <string, object> GetRequestContentForInjectionDashboardRegistration(DashboardHelpers.Parameters parameter, InjectionInput inputType) { var orginalRequest = new Dictionary <string, object>(DashboardHelpers.DashboardRegistrationDefaultParameters(UserIds)); var request = orginalRequest["settings"] as Dictionary <string, object>; var injectionData = InjectionInputData.InjectionInputMapper[inputType]; switch (parameter) { case DashboardHelpers.Parameters.Agents: request["owners"] = new Dictionary <string, string> { ["agents"] = injectionData }; break; case DashboardHelpers.Parameters.Depts: request["owners"] = new Dictionary <string, string> { ["depts"] = injectionData }; break; case DashboardHelpers.Parameters.TimePeriodType: request["timePeriod"] = new Dictionary <string, string> { ["type"] = injectionData }; break; case DashboardHelpers.Parameters.Type: orginalRequest["type"] = injectionData; break; default: request[Char.ToLowerInvariant(parameter.ToString()[0]) + parameter.ToString().Substring(1)] = injectionData; break; } if (parameter == DashboardHelpers.Parameters.Settings) { orginalRequest["settings"] = injectionData; } else { orginalRequest["settings"] = request; } return(orginalRequest); }
private Dictionary <string, object> GetRequestContentForInvalidDashboardRegistration(DashboardHelpers.Parameters parameter, InvalidTestCases inputType) { var orginalRequest = new Dictionary <string, object>(DashboardHelpers.DashboardRegistrationDefaultParameters(UserIds)); var request = orginalRequest["settings"] as Dictionary <string, object>; var parameterName = Char.ToLowerInvariant(parameter.ToString()[0]) + parameter.ToString().Substring(1); if (inputType != InvalidTestCases.Missing) { switch (parameter) { case DashboardHelpers.Parameters.Agents: request["owners"] = new Dictionary <string, string> { ["agents"] = inputType == InvalidTestCases.Negative ? "-2" : InvalidMaps[inputType].ToString() }; break; case DashboardHelpers.Parameters.Depts: request["owners"] = new Dictionary <string, string> { ["depts"] = InvalidMaps[inputType].ToString() }; break; case DashboardHelpers.Parameters.TimePeriodType: request["timePeriod"] = new Dictionary <string, string> { ["type"] = InvalidMaps[inputType].ToString() }; break; case DashboardHelpers.Parameters.Settings: orginalRequest["settings"] = InvalidMaps[inputType].ToString(); break; case DashboardHelpers.Parameters.Type: orginalRequest["type"] = InvalidMaps[inputType].ToString(); break; default: request[parameterName] = InvalidMaps[inputType].ToString(); break; } } else if (inputType == InvalidTestCases.Missing) { if (DashboardHelpers.Parameters.Settings == parameter || DashboardHelpers.Parameters.Type == parameter) { orginalRequest.Remove(parameterName); } else if (DashboardHelpers.Parameters.Agents == parameter || DashboardHelpers.Parameters.Depts == parameter) { (request["owners"] as Dictionary <string, List <int> >).Remove(parameterName); } else if (DashboardHelpers.Parameters.TimePeriodType == parameter) { (request["timePeriod"] as Dictionary <string, string>).Remove("type"); } else { request.Remove(parameterName); } } orginalRequest["settings"] = request; return(orginalRequest); }