public static void VerifyContainExpectedSelect(FieldDetailsResponse fieldDetailsResponse, ValidSelect select) { foreach (var item in fieldDetailsResponse.Values.Select(v => v.Value)) { PrAssert.That(item.Id, PrIs.Not.Null, "The response does not contains Id"); if (select == ValidSelect.Missing || GetExpectedSelect(select).Contains(Select.Alias.GetEnumStringValue())) { PrAssert.That(item.Alias, PrIs.Not.Null, "The response does not contains Alias"); } if (select == ValidSelect.Missing || GetExpectedSelect(select).Contains(Select.Resource.GetEnumStringValue())) { PrAssert.That(item.Resource, PrIs.Not.Null, "The response does not contains Resource"); } if (select == ValidSelect.Missing || GetExpectedSelect(select).Contains(Select.DataType.GetEnumStringValue())) { PrAssert.That(item.DataType, PrIs.Not.Null, "The response does not contains Datatype"); } if (select != ValidSelect.Missing && GetExpectedSelect(select).Contains(Properties.Parameters.Properties.GetEnumStringValue())) { PrAssert.That(item.Properties, PrIs.Not.Null.And.Not.Empty, "The response does not contains Properties"); PrAssert.That(item.Properties.Keys, PrIs.Not.Null.And.Not.Empty, "The response does not contains Properties keys"); PrAssert.That(item.Properties.Keys, PrIs.EquivalentTo(GetExpectedProperties(select)), "The response does not contains Id"); } } }
public void GetComputationInfoTest(ResourceId resource, HRBCClientPrivate.API.Field.FieldType fieldType, string formula, int precision, Dictionary <string, string[]> expectedOutput) { var response = (new DefaultManager()).Send <GetComputationInfoResponse>(new GetComputationInfoReqeust { ResourceId = (int)resource }); var adaptedExpectedResult = expectedOutput.ToDictionary(x => GetAlias(resource, fieldType, CodeToIndexMap[x.Key]), x => x.Value.Select(item => GetAlias(resource, fieldType, CodeToIndexMap[item])).ToList()); PrAssert.That(response, PrIs.SuccessfulResponse <GetComputationInfoResponse>()); PrAssert.That(response.Result.ComputationInfo.Select(x => x.Field).ToList(), PrIs.Not.Null.And.EquivalentTo(adaptedExpectedResult.Keys.ToList())); foreach (var fieldInfo in response.Result.ComputationInfo) { PrAssert.That(fieldInfo.AffectedTerminalFields, PrIs.EquivalentTo(adaptedExpectedResult[fieldInfo.Field])); } }
public static void VerifyContainExpectedSelect(FieldReadResponseItem fieldDetailsResponse, IEnumerable <ValidSelect> selects) { foreach (var item in fieldDetailsResponse.Result) { PrAssert.That(item.Id, PrIs.Not.Null, "The response does not contains Id"); if (GetExpectedSelect(selects).Contains(Select.Alias.GetEnumStringValue())) { PrAssert.That(item.Alias, PrIs.Not.Null, "The response does not contains Alias"); } if (selects.Contains(ValidSelect.Missing) || GetExpectedSelect(selects).Contains(Select.Resource.GetEnumStringValue())) { PrAssert.That(item.Resource, PrIs.Not.Null, "The response does not contains Resource"); } if (GetExpectedSelect(selects).Contains(Properties.Parameters.Properties.GetEnumStringValue())) { PrAssert.That(item.Properties, PrIs.Not.Null.And.Not.Empty, "The response does not contains Properties"); PrAssert.That(item.Properties.Keys, PrIs.Not.Null.And.Not.Empty, "The response does not contains Properties keys"); PrAssert.That(item.Properties.Keys, PrIs.EquivalentTo(GetExpectedProperties(selects)), "The response does not contains Id"); } } }