Skip to content

Commit 6e8941e

Browse files
committed
C#: Add a couple more testcases.
1 parent 4123876 commit 6e8941e

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

csharp/ql/test/utils/modelgenerator/dataflow/Summaries.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,3 +642,41 @@ public string M2(C c)
642642
return c.Field;
643643
}
644644
}
645+
646+
public class IDictionaryFlow
647+
{
648+
// summary=Models;IDictionaryFlow;false;ReturnIDictionaryValue;(System.Collections.Generic.IDictionary<System.Object,System.Object>,System.Object);;Argument[0].Element;ReturnValue;taint;df-generated
649+
// contentbased-summary=Models;IDictionaryFlow;false;ReturnIDictionaryValue;(System.Collections.Generic.IDictionary<System.Object,System.Object>,System.Object);;Argument[0].Element.Property[System.Collections.Generic.KeyValuePair`2.Value];ReturnValue;value;df-generated
650+
public object ReturnIDictionaryValue(IDictionary<object, object> input, object key)
651+
{
652+
return input[key];
653+
}
654+
}
655+
656+
public class NestedFieldFlow
657+
{
658+
public NestedFieldFlow FieldA;
659+
public NestedFieldFlow FieldB;
660+
661+
// summary=Models;NestedFieldFlow;false;Move;();;Argument[this];ReturnValue;taint;df-generated
662+
// contentbased-summary=Models;NestedFieldFlow;false;Move;();;Argument[this].Field[Models.NestedFieldFlow.FieldA];ReturnValue.Field[Models.NestedFieldFlow.FieldB];value;df-generated
663+
public NestedFieldFlow Move()
664+
{
665+
return new NestedFieldFlow() { FieldB = this.FieldA };
666+
}
667+
668+
// summary=Models;NestedFieldFlow;false;MoveNested;();;Argument[this];ReturnValue;taint;df-generated
669+
// contentbased-summary=Models;NestedFieldFlow;false;MoveNested;();;Argument[this].Field[Models.NestedFieldFlow.FieldB].Field[Models.NestedFieldFlow.FieldA];ReturnValue.Field[Models.NestedFieldFlow.FieldA].Field[Models.NestedFieldFlow.FieldB];value;df-generated
670+
public NestedFieldFlow MoveNested()
671+
{
672+
return new NestedFieldFlow() { FieldA = FieldB.Move() };
673+
}
674+
675+
// summary=Models;NestedFieldFlow;false;ReverseFields;();;Argument[this];ReturnValue;taint;df-generated
676+
// contentbased-summary=Models;NestedFieldFlow;false;ReverseFields;();;Argument[this].Field[Models.NestedFieldFlow.FieldA].Field[Models.NestedFieldFlow.FieldB];ReturnValue.Field[Models.NestedFieldFlow.FieldA].Field[Models.NestedFieldFlow.FieldB];value;df-generated
677+
public NestedFieldFlow ReverseFields()
678+
{
679+
var x = new NestedFieldFlow() { FieldB = this.FieldA.FieldB };
680+
return new NestedFieldFlow() { FieldA = x };
681+
}
682+
}

0 commit comments

Comments
 (0)