Hi,
i have some logical and architectural doubts here.I am stuck on some bad logic and architect.Somebody
please help me to solve this issue.I have a dot net core 3.1 app.I need to loop through some testCasesCountand i need to
check and certify one key Based on that i need to do this all..Basicaly i am checking some testcases and key validation.Please find below conditions
1.KEY CAN BE NULL------- NOT CERTIFIED
2.KEY CAN BE THERE BUT NOT THE EXACT KEY---------NOT CERTIFIED
3.KEY IS THERE,EXACT ONE-------CERTIFIED
4.ResultStatus =This is test case result status.Passed or Failed in test cases
TestCases = array of multiple test cases
Message =error msg based on case we have to add
ResultStatus =Passed or Failed in test cases
DataKey =some key like 4252634343567TSA
TestType =smoke/unit test
ResultStatus , DataKey values can determine following cases
Case 1- All test cases execute and pass, certificate key found and certified
Result-test cases found. All test cases passed.Data certified.
Case 2- Some or all test cases failed, certificate key found and certified
Result-
WARNING: test cases found. The following test test cases failed:
Test case ID '1'
Test case ID '123'
Test case ID '4223'
Test case ID '321'
Data certified.
Case 3- Some OR all test cases failed, certificate key NOT found
Result -
WARNING: test cases found. The following test test cases failed:
Test case ID '1'
Test case ID '123'
Test case ID '4223'
Test case ID '321'
WARNING: No data certificate key found, data not certified'
Case 4 – All test cases execute and pass, certificate key found and NOT certified
Result -
test cases found. All test cases passed.
WARNING: data certificate key found, Certification key not valid, data not certified'
how i can loop through all cases?
What I have tried:
i have this method:-
public Task GetTestResults(string infoset){
//getting "resultDataSet" from DB
var table = resultDataSet.Tables[0];
var results = table
.Rows
.Cast()
?.Select(x => new ResultModel
{
TestCases = x["TestCases"] as string,// array of multiple test cases Test case ID '1',Test case ID '123' etc
Message = x["ErrorMessage"] as string, //error msg
ResultStatus = x["ResultStatus"] as string //Passed or Failed
DataKey = x["ValidationKey"] as string,//some key like 4252634343567TSA
TestType = x["TestType"] as string //smoke/unit test
});
bool isValidKey = await _Ichekkey.IsValidcertificateKey(string key)//DataKey i have to use .Any better way to call this method otherthan this in architecturalway?
int testCasesCount = Convert.ToInt32(table.Rows[0]["TestCases"]);
// var results contain all information to loop how i can do that loop with above cases.
}
I am stuck on here how i can loop through all cases? (results )
which is the right way to call bool isValidKey = await _Ichekkey.IsValidcertificateKey(string key)