Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Yoti.Auth/DocScan/Session/Retrieve/BreakdownResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ public class BreakdownResponse

[JsonProperty(PropertyName = "details")]
public List<DetailsResponse> Details { get; private set; }

[JsonProperty(PropertyName = "process")]
public string Process { get; private set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,56 @@ public void CheckBreakdownResponseIsParsed()
AssertBreakdownResponseValuesCorrect(breakdownResponse, response);
}

[TestMethod]
public void CheckBreakdownResponseProcessIsAutomated()
{
dynamic breakdownResponse = new
{
sub_check = "issuing_authority_verification",
result = "PASS",
process = "AUTOMATED",
details = new List<dynamic>()
};

string json = JsonConvert.SerializeObject(breakdownResponse);
BreakdownResponse response = JsonConvert.DeserializeObject<BreakdownResponse>(json);

Assert.AreEqual("AUTOMATED", response.Process);
}

[TestMethod]
public void CheckBreakdownResponseProcessIsExpertReview()
{
dynamic breakdownResponse = new
{
sub_check = "issuing_authority_verification",
result = "PASS",
process = "EXPERT_REVIEW",
details = new List<dynamic>()
};

string json = JsonConvert.SerializeObject(breakdownResponse);
BreakdownResponse response = JsonConvert.DeserializeObject<BreakdownResponse>(json);

Assert.AreEqual("EXPERT_REVIEW", response.Process);
}

[TestMethod]
public void CheckBreakdownResponseProcessIsNullWhenAbsent()
{
dynamic breakdownResponse = new
{
sub_check = "issuing_authority_verification",
result = "PASS",
details = new List<dynamic>()
};

string json = JsonConvert.SerializeObject(breakdownResponse);
BreakdownResponse response = JsonConvert.DeserializeObject<BreakdownResponse>(json);

Assert.IsNull(response.Process);
}

[TestMethod]
public void CheckReportResponseIsParsed()
{
Expand Down Expand Up @@ -253,6 +303,7 @@ private dynamic GetBreakdownResponse()
{
sub_check = "issuing_authority_verification",
result = "PASS",
process = "AUTOMATED",
details = new List<dynamic> {
new { name = "n1", value = "v1" },
new { name = "n2", value = "v2" }
Expand All @@ -272,6 +323,7 @@ private static void AssertBreakdownResponseValuesCorrect(dynamic breakdownRespon
{
Assert.AreEqual(breakdownResponse.sub_check, response.SubCheck);
Assert.AreEqual(breakdownResponse.result, response.Result);
Assert.AreEqual(breakdownResponse.process, response.Process);

var detailsList = (breakdownResponse.details as IEnumerable<dynamic>);
Assert.AreEqual(detailsList.First().name, response.Details.First().Name);
Expand Down