私は、解析されたテストの実行から情報を保持する辞書を持っています。キーはメソッドの名前で、値はTestRunProperties
のリストです。私の辞書には、テスト実行のすべてのメソッドが含まれており、テストの実行中に失敗したメソッドを削除したいと考えています。 Linqとこれは可能ですか?辞書C#からLinqで特定の値を削除する
TestRunPropertiesクラス:
public class TestRunProperties
{
public string computerName { get; set; }
public TimeSpan duration { get; set; }
public string startTime { get; set; }
public string endTime { get; set; }
public string testName { get; set; }
public string outcome { get; set; }
}
辞書:
//Key is the name of the method, value is the properties associated with each run
private static Dictionary<string, List<TestRunProperties>> runResults = new Dictionary<string, List<TestRunProperties>>();
私はこれを試してみたが、私はWhere
一部と混同しそうだと思う:
runResults.Remove(runResults.Where(methodName => methodName.Value.Where(method => method.outcome.ToLower().Equals("failed"))));
私は」 LinqとLambdaにとってはまったく新しく、私はまだこのようなデータへのアクセス方法を理解しようとしています。
、あなたの助けのためにすべて本当に素晴らしい答えをありがとうございました! – Novastorm