public void PassingArrayReferenceToParamsArgumentWhenMethodAccessedViaStaticUsingShouldResultInWarning()
{
var testContent = @"
using Bridge;
using static Bridge.React.DOM;
namespace TestCase
{
public class Example
{
public Bridge.React.ReactElement Get()
{
return Div(null, new SomethingCastableToAnyReactElementOrString());
}
}
public class SomethingCastableToAnyReactElementOrString
{
public static implicit operator Union<Bridge.React.ReactElement, string>[](SomethingCastableToAnyReactElementOrString value)
{
return null; // It's not important what this returns, only that its return type is Union<ReactElement, string>[]
}
}
}";
var expected = new DiagnosticResult
{
Id = DynamicChildrenUniqueIdWorkaroundAnalyser.DiagnosticId,
Message = string.Format(DynamicChildrenUniqueIdWorkaroundAnalyser.DynamicChildrenUniqueIdWarningBypassRule.MessageFormat.ToString(), "Div"),
Severity = DiagnosticSeverity.Warning,
Locations = new[]
{
new DiagnosticResultLocation("Test0.cs", 11, 25)
}
};
VerifyCSharpDiagnostic(testContent, expected);
}