Bridge.React.Analyser.Test.DynamicChildrenUniqueIdWorkaroundTests.PassingSomethingThatWillBeCastToArryReferenceShouldResultInWarning C# (CSharp) Метод

PassingSomethingThatWillBeCastToArryReferenceShouldResultInWarning() приватный Метод

private PassingSomethingThatWillBeCastToArryReferenceShouldResultInWarning ( ) : void
Результат void
		public void PassingSomethingThatWillBeCastToArryReferenceShouldResultInWarning()
		{
			var testContent = @"
				using Bridge;
				using Bridge.React;

				namespace TestCase
				{
					public class Example
					{
						public ReactElement Get()
						{
							return DOM.Div(null, new SomethingCastableToAnyReactElementOrString());
						}
					}

					public class SomethingCastableToAnyReactElementOrString
					{
						public static implicit operator Union<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, 29)
				}
			};

			VerifyCSharpDiagnostic(testContent, expected);
		}