Skip to content

Commit

Permalink
Added single test for calling explicitly implemented interface method #…
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Oct 20, 2021
1 parent ca5706c commit 2259aed
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ public string GetStringFromInt32(int value)
}
}

public class InstanceImplementExplicitlyType : IInterfaceType1
{
// It's the instance field, referrer from the method at same type.
private readonly int rhs = 100;

string IInterfaceType1.GetStringFromInt32(int value)
{
return (value + rhs).ToString();
}
}

public interface IInterfaceType2
{
string GetStringFromInt64(long value);
Expand Down Expand Up @@ -250,6 +261,7 @@ public class InstanceMultipleImplement3DepthType : InstanceMultipleImplement2Dep
[TestId("TypeRelations")]
[TestCase("223", "InstanceImplement", 123, IncludeTypes = new[] { typeof(InstanceImplementType), typeof(IInterfaceType1) })]
[TestCase("223", "InstanceImplementFromInterface", 123, IncludeTypes = new[] { typeof(InstanceImplementType), typeof(IInterfaceType1) })]
[TestCase("223", "InstanceImplementExplicitlyTypeFromInterface", 123, IncludeTypes = new[] { typeof(InstanceImplementExplicitlyType), typeof(IInterfaceType1) })]
[TestCase("223", "InstanceMultipleImplement1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
[TestCase("223", "InstanceMultipleImplementFromInterface1", 123, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
[TestCase("323", "InstanceMultipleImplement2", 123L, IncludeTypes = new[] { typeof(InstanceMultipleImplementType), typeof(IInterfaceType1), typeof(IInterfaceType2) })]
Expand Down Expand Up @@ -293,6 +305,12 @@ public static string InstanceImplementFromInterface(int value)
return inst.GetStringFromInt32(value);
}

public static string InstanceImplementExplicitlyTypeFromInterface(int value)
{
IInterfaceType1 inst = new InstanceImplementExplicitlyType();
return inst.GetStringFromInt32(value);
}

public static string InstanceMultipleImplement1(int value)
{
var inst = new InstanceMultipleImplementType();
Expand Down

0 comments on commit 2259aed

Please sign in to comment.