How to use OuterT class of TestClasses package

Best Vstest code snippet using TestClasses.OuterT

ManagedNameRoundTripTests.cs

Source:ManagedNameRoundTripTests.cs Github

copy

Full Screen

1// Copyright (c) Microsoft Corporation. All rights reserved.2// Licensed under the MIT license. See LICENSE file in the project root for full license information.3namespace Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities.UnitTests4{5 using Microsoft.CodeAnalysis;6 using Microsoft.CodeAnalysis.CSharp;7 using Microsoft.TestPlatform.AdapterUtilities.ManagedNameUtilities;8 using Microsoft.VisualStudio.TestTools.UnitTesting;9 using System.IO;10 using System.Linq;11 using System.Reflection;12 [TestClass]13 [DeploymentItem("TestClasses.cs")]14 public partial class ManagedNameRoundTripTests15 {16 private const BindingFlags PrivateBindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;17 private Compilation _compilation;18 [TestInitialize]19 public void Initialize()20 => _compilation = CSharpCompilation.Create(21 "Test.dll",22 new[] { CSharpSyntaxTree.ParseText(File.ReadAllText("TestClasses.cs")) },23 new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) });24 [TestMethod]25 public void Simple1()26 {27 var outer = _compilation.GetTypeByMetadataName("TestClasses.Outer");28 VerifyRoundTrip(29 methodInfo: typeof(TestClasses.Outer).GetMethod("Method0"),30 containingTypeSymbol: outer,31 methodSymbol: outer.FindMethod("Method0"),32 managedTypeName: "TestClasses.Outer",33 managedMethodName: "Method0");34 }35 [TestMethod]36 public void Simple2()37 {38 var outer = _compilation.GetTypeByMetadataName("TestClasses.Outer");39 VerifyRoundTrip(40 methodInfo: typeof(TestClasses.Outer).GetMethod("Method1"),41 containingTypeSymbol: outer,42 methodSymbol: outer.FindMethod("Method1"),43 managedTypeName: "TestClasses.Outer",44 managedMethodName: "Method1(System.Int32)");45 }46 [TestMethod]47 public void Simple3()48 {49 var outer = _compilation.GetTypeByMetadataName("TestClasses.Outer");50 VerifyRoundTrip(51 methodInfo: typeof(TestClasses.Outer).GetMethod("Method2"),52 containingTypeSymbol: outer,53 methodSymbol: outer.FindMethod("Method2"),54 managedTypeName: "TestClasses.Outer",55 managedMethodName: "Method2(System.Collections.Generic.List`1<System.String>)");56 }57 [TestMethod]58 public void Simple4()59 {60 var outer = _compilation.GetTypeByMetadataName("TestClasses.Outer");61 VerifyRoundTrip(62 methodInfo: typeof(TestClasses.Outer).GetMethod("Method3"),63 containingTypeSymbol: outer,64 methodSymbol: outer.FindMethod("Method3"),65 managedTypeName: "TestClasses.Outer",66 managedMethodName: "Method3(System.String,System.Int32)");67 }68 [TestMethod]69 public void Nested1()70 {71 var outerInner = _compilation.GetTypeByMetadataName("TestClasses.Outer+Inner");72 VerifyRoundTrip(73 methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method0"),74 containingTypeSymbol: outerInner,75 methodSymbol: outerInner.FindMethod("Method0"),76 managedTypeName: "TestClasses.Outer+Inner",77 managedMethodName: "Method0");78 }79 [TestMethod]80 public void Nested2()81 {82 var outerInner = _compilation.GetTypeByMetadataName("TestClasses.Outer+Inner");83 VerifyRoundTrip(84 methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method1"),85 containingTypeSymbol: outerInner,86 methodSymbol: outerInner.FindMethod("Method1"),87 managedTypeName: "TestClasses.Outer+Inner",88 managedMethodName: "Method1(System.Int32)");89 }90 [TestMethod]91 public void OpenGeneric1()92 {93 var outerT = _compilation.GetTypeByMetadataName("TestClasses.Outer`1");94 VerifyRoundTrip(95 methodInfo: typeof(TestClasses.Outer<>).GetMethod("Method0"),96 containingTypeSymbol: outerT,97 methodSymbol: outerT.FindMethod("Method0"),98 managedTypeName: "TestClasses.Outer`1",99 managedMethodName: "Method0");100 }101 [TestMethod]102 public void OpenGeneric2()103 {104 var outerT = _compilation.GetTypeByMetadataName("TestClasses.Outer`1");105 VerifyRoundTrip(106 methodInfo: typeof(TestClasses.Outer<>).GetMethod("Method1"),107 containingTypeSymbol: outerT,108 methodSymbol: outerT.FindMethod("Method1"),109 managedTypeName: "TestClasses.Outer`1",110 managedMethodName: "Method1(!0)");111 }112 [TestMethod]113 public void OpenGeneric3()114 {115 var outerT = _compilation.GetTypeByMetadataName("TestClasses.Outer`1");116 VerifyRoundTrip(117 methodInfo: typeof(TestClasses.Outer<>).GetMethod("Method2"),118 containingTypeSymbol: outerT,119 methodSymbol: outerT.FindMethod("Method2"),120 managedTypeName: "TestClasses.Outer`1",121 managedMethodName: "Method2`1(!!0[])");122 }123 [TestMethod]124 public void OpenGeneric4()125 {126 var outerT = _compilation.GetTypeByMetadataName("TestClasses.Outer`1");127 VerifyRoundTrip(128 methodInfo: typeof(TestClasses.Outer<>).GetMethod("Method3"),129 containingTypeSymbol: outerT,130 methodSymbol: outerT.FindMethod("Method3"),131 managedTypeName: "TestClasses.Outer`1",132 managedMethodName: "Method3`1(!0,!!0)");133 }134 [TestMethod]135 public void OpenGenericNested1()136 {137 var outerTInnterV = _compilation.GetTypeByMetadataName("TestClasses.Outer`1+Inner`1");138 VerifyRoundTrip(139 methodInfo: typeof(TestClasses.Outer<>.Inner<>).GetMethod("Method0"),140 containingTypeSymbol: outerTInnterV,141 methodSymbol: outerTInnterV.FindMethod("Method0"),142 managedTypeName: "TestClasses.Outer`1+Inner`1",143 managedMethodName: "Method0");144 }145 [TestMethod]146 public void OpenGenericNested2()147 {148 var outerTInnterV = _compilation.GetTypeByMetadataName("TestClasses.Outer`1+Inner`1");149 VerifyRoundTrip(150 methodInfo: typeof(TestClasses.Outer<>.Inner<>).GetMethod("Method1"),151 containingTypeSymbol: outerTInnterV,152 methodSymbol: outerTInnterV.FindMethod("Method1"),153 managedTypeName: "TestClasses.Outer`1+Inner`1",154 managedMethodName: "Method1(!0)");155 }156 [TestMethod]157 public void OpenGenericNested3()158 {159 var outerTInnterV = _compilation.GetTypeByMetadataName("TestClasses.Outer`1+Inner`1");160 VerifyRoundTrip(161 methodInfo: typeof(TestClasses.Outer<>.Inner<>).GetMethod("Method2"),162 containingTypeSymbol: outerTInnterV,163 methodSymbol: outerTInnterV.FindMethod("Method2"),164 managedTypeName: "TestClasses.Outer`1+Inner`1",165 managedMethodName: "Method2(!1)");166 }167 [TestMethod]168 public void OpenGenericNested4()169 {170 var outerTInnterV = _compilation.GetTypeByMetadataName("TestClasses.Outer`1+Inner`1");171 VerifyRoundTrip(172 methodInfo: typeof(TestClasses.Outer<>.Inner<>).GetMethod("Method3"),173 containingTypeSymbol: outerTInnterV,174 methodSymbol: outerTInnterV.FindMethod("Method3"),175 managedTypeName: "TestClasses.Outer`1+Inner`1",176 managedMethodName: "Method3`1(!0,!!0,!1)");177 }178 [TestMethod]179 public void OpenGenericNested5()180 {181 var outerTInnterV = _compilation.GetTypeByMetadataName("TestClasses.Outer`1+Inner`1");182 VerifyRoundTrip(183 methodInfo: typeof(TestClasses.Outer<>.Inner<>).GetMethod("Method4"),184 containingTypeSymbol: outerTInnterV,185 methodSymbol: outerTInnterV.FindMethod("Method4"),186 managedTypeName: "TestClasses.Outer`1+Inner`1",187 managedMethodName: "Method4`2(!!1,!!0)");188 }189 [TestMethod]190 public void OpenGenericNested6()191 {192 var outerTInnerVMoreInnerI = _compilation.GetTypeByMetadataName("TestClasses.Outer`1+Inner`1+MoreInner`1");193 VerifyRoundTrip(194 methodInfo: typeof(TestClasses.Outer<>.Inner<>.MoreInner<>).GetMethod("Method0"),195 containingTypeSymbol: outerTInnerVMoreInnerI,196 methodSymbol: outerTInnerVMoreInnerI.FindMethod("Method0"),197 managedTypeName: "TestClasses.Outer`1+Inner`1+MoreInner`1",198 managedMethodName: "Method0`1(!0,!1,!2,!!0)");199 }200 [TestMethod]201 public void ClosedGeneric1()202 {203 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);204 var outerTInt = _compilation.GetTypeByMetadataName("TestClasses.Outer`1").Construct(@int);205 VerifyRoundTrip(206 methodInfo: typeof(TestClasses.Outer<int>).GetMethod("Method0"),207 containingTypeSymbol: outerTInt,208 methodSymbol: outerTInt.FindMethod("Method0"),209 managedTypeName: "TestClasses.Outer`1",210 managedMethodName: "Method0");211 }212 [TestMethod]213 public void ClosedGeneric2()214 {215 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);216 var outerTInt = _compilation.GetTypeByMetadataName("TestClasses.Outer`1").Construct(@int);217 VerifyRoundTrip(218 methodInfo: typeof(TestClasses.Outer<int>).GetMethod("Method1"),219 containingTypeSymbol: outerTInt,220 methodSymbol: outerTInt.FindMethod("Method1"),221 managedTypeName: "TestClasses.Outer`1",222 managedMethodName: "Method1(!0)");223 }224 [TestMethod]225 public void ClosedGeneric3()226 {227 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);228 var outerTInt = _compilation.GetTypeByMetadataName("TestClasses.Outer`1").Construct(@int);229 VerifyRoundTrip(230 methodInfo: typeof(TestClasses.Outer<int>).GetMethod("Method2"),231 containingTypeSymbol: outerTInt,232 methodSymbol: outerTInt.FindMethod("Method2"),233 managedTypeName: "TestClasses.Outer`1",234 managedMethodName: "Method2`1(!!0[])");235 }236 [TestMethod]237 public void ClosedGeneric4()238 {239 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);240 var outerTInt = _compilation.GetTypeByMetadataName("TestClasses.Outer`1").Construct(@int);241 VerifyRoundTrip(242 methodInfo: typeof(TestClasses.Outer<int>).GetMethod("Method3"),243 containingTypeSymbol: outerTInt,244 methodSymbol: outerTInt.FindMethod("Method3"),245 managedTypeName: "TestClasses.Outer`1",246 managedMethodName: "Method3`1(!0,!!0)");247 }248 [TestMethod]249 public void ClosedGenericNested1()250 {251 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);252 var @string = _compilation.GetSpecialType(SpecialType.System_String);253 var outerTInt = _compilation.GetTypeByMetadataName("TestClasses.Outer`1").Construct(@int);254 var outerTIntInnerVString = outerTInt.GetTypeMembers().Single().Construct(@string);255 VerifyRoundTrip(256 methodInfo: typeof(TestClasses.Outer<int>.Inner<string>).GetMethod("Method0"),257 containingTypeSymbol: outerTIntInnerVString,258 methodSymbol: outerTIntInnerVString.FindMethod("Method0"),259 managedTypeName: "TestClasses.Outer`1+Inner`1",260 managedMethodName: "Method0");261 }262 [TestMethod]263 public void ClosedGenericNested2()264 {265 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);266 var @string = _compilation.GetSpecialType(SpecialType.System_String);267 var outerTInt = _compilation.GetTypeByMetadataName("TestClasses.Outer`1").Construct(@int);268 var outerTIntInnerVString = outerTInt.GetTypeMembers().Single().Construct(@string);269 VerifyRoundTrip(270 methodInfo: typeof(TestClasses.Outer<int>.Inner<string>).GetMethod("Method1"),271 containingTypeSymbol: outerTIntInnerVString,272 methodSymbol: outerTIntInnerVString.FindMethod("Method1"),273 managedTypeName: "TestClasses.Outer`1+Inner`1",274 managedMethodName: "Method1(!0)");275 }276 [TestMethod]277 public void ClosedGenericNested3()278 {279 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);280 var @string = _compilation.GetSpecialType(SpecialType.System_String);281 var outerTInt = _compilation.GetTypeByMetadataName("TestClasses.Outer`1").Construct(@int);282 var outerTIntInnerVString = outerTInt.GetTypeMembers().Single().Construct(@string);283 VerifyRoundTrip(284 methodInfo: typeof(TestClasses.Outer<int>.Inner<string>).GetMethod("Method2"),285 containingTypeSymbol: outerTIntInnerVString,286 methodSymbol: outerTIntInnerVString.FindMethod("Method2"),287 managedTypeName: "TestClasses.Outer`1+Inner`1",288 managedMethodName: "Method2(!1)");289 }290 [TestMethod]291 public void ClosedGenericNested4()292 {293 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);294 var @string = _compilation.GetSpecialType(SpecialType.System_String);295 var outerTInt = _compilation.GetTypeByMetadataName("TestClasses.Outer`1").Construct(@int);296 var outerTIntInnerVString = outerTInt.GetTypeMembers().Single().Construct(@string);297 VerifyRoundTrip(298 methodInfo: typeof(TestClasses.Outer<int>.Inner<string>).GetMethod("Method3"),299 containingTypeSymbol: outerTIntInnerVString,300 methodSymbol: outerTIntInnerVString.FindMethod("Method3"),301 managedTypeName: "TestClasses.Outer`1+Inner`1",302 managedMethodName: "Method3`1(!0,!!0,!1)");303 }304 [TestMethod]305 public void ClosedGenericNested5()306 {307 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);308 var @string = _compilation.GetSpecialType(SpecialType.System_String);309 var outerTInt = _compilation.GetTypeByMetadataName("TestClasses.Outer`1").Construct(@int);310 var outerTIntInnerVString = outerTInt.GetTypeMembers().Single().Construct(@string);311 VerifyRoundTrip(312 methodInfo: typeof(TestClasses.Outer<int>.Inner<string>).GetMethod("Method4"),313 containingTypeSymbol: outerTIntInnerVString,314 methodSymbol: outerTIntInnerVString.FindMethod("Method4"),315 managedTypeName: "TestClasses.Outer`1+Inner`1",316 managedMethodName: "Method4`2(!!1,!!0)");317 }318 [TestMethod]319 public void ClosedGenericMethod1()320 {321 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);322 var @string = _compilation.GetSpecialType(SpecialType.System_String);323 var outerTInt = _compilation.GetTypeByMetadataName("TestClasses.Outer`1").Construct(@int);324 VerifyRoundTrip(325 methodInfo: typeof(TestClasses.Outer<int>).GetMethod("Method3").MakeGenericMethod(typeof(string)),326 containingTypeSymbol: outerTInt,327 methodSymbol: outerTInt.FindMethod("Method3").Construct(@string),328 managedTypeName: "TestClasses.Outer`1",329 managedMethodName: "Method3`1(!0,!!0)");330 }331 [TestMethod]332 public void ClosedGenericMethod2()333 {334 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);335 var outerInner = _compilation.GetTypeByMetadataName("TestClasses.Outer+Inner");336 VerifyRoundTrip(337 methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method2").MakeGenericMethod(typeof(int)),338 containingTypeSymbol: outerInner,339 methodSymbol: outerInner.FindMethod("Method2").Construct(@int),340 managedTypeName: "TestClasses.Outer+Inner",341 managedMethodName: "Method2`1(System.Int32)");342 }343 [TestMethod]344 public void ClosedGenericMethod3()345 {346 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);347 var @float = _compilation.GetSpecialType(SpecialType.System_Single);348 var @string = _compilation.GetSpecialType(SpecialType.System_String);349 var outerInner = _compilation.GetTypeByMetadataName("TestClasses.Outer+Inner");350 VerifyRoundTrip(351 methodInfo: typeof(TestClasses.Outer.Inner).GetMethod("Method3").MakeGenericMethod(typeof(float), typeof(string)),352 containingTypeSymbol: outerInner,353 methodSymbol: outerInner.FindMethod("Method3").Construct(@float, @string),354 managedTypeName: "TestClasses.Outer+Inner",355 managedMethodName: "Method3`2(System.Int32)");356 }357 [TestMethod]358 public void ExplicitInterfaceImplementation1()359 {360 var impl = _compilation.GetTypeByMetadataName("TestClasses.Impl");361 VerifyRoundTrip(362 methodInfo: typeof(TestClasses.Impl).GetMethod("TestClasses.IImplementation.ImplMethod0", PrivateBindingFlags),363 containingTypeSymbol: impl,364 methodSymbol: impl.FindMethod("TestClasses.IImplementation.ImplMethod0"),365 managedTypeName: "TestClasses.Impl",366 managedMethodName: "TestClasses.IImplementation.ImplMethod0");367 }368 [TestMethod]369 public void ExplicitInterfaceImplementation2()370 {371 var impl = _compilation.GetTypeByMetadataName("TestClasses.Impl");372 VerifyRoundTrip(373 methodInfo: typeof(TestClasses.Impl).GetMethod("TestClasses.IImplementation.ImplMethod1", PrivateBindingFlags),374 containingTypeSymbol: impl,375 methodSymbol: impl.FindMethod("TestClasses.IImplementation.ImplMethod1"),376 managedTypeName: "TestClasses.Impl",377 managedMethodName: "TestClasses.IImplementation.ImplMethod1(System.Int32)");378 }379 [TestMethod]380 public void GenericExplicitInterfaceImplementation1()381 {382 var implT = _compilation.GetTypeByMetadataName("TestClasses.Impl`1");383 VerifyRoundTrip(384 methodInfo: typeof(TestClasses.Impl<>).GetMethod("TestClasses.IImplementation<T>.ImplMethod0", PrivateBindingFlags),385 containingTypeSymbol: implT,386 methodSymbol: implT.FindMethod("TestClasses.IImplementation<T>.ImplMethod0"),387 managedTypeName: "TestClasses.Impl`1",388 managedMethodName: "'TestClasses.IImplementation<T>.ImplMethod0'");389 }390 [TestMethod]391 public void GenericExplicitInterfaceImplementation2()392 {393 var implT = _compilation.GetTypeByMetadataName("TestClasses.Impl`1");394 VerifyRoundTrip(395 methodInfo: typeof(TestClasses.Impl<>).GetMethod("TestClasses.IImplementation<T>.ImplMethod1", PrivateBindingFlags),396 containingTypeSymbol: implT,397 methodSymbol: implT.FindMethod("TestClasses.IImplementation<T>.ImplMethod1"),398 managedTypeName: "TestClasses.Impl`1",399 managedMethodName: "'TestClasses.IImplementation<T>.ImplMethod1'(!0)");400 }401 [TestMethod]402 public void GenericExplicitInterfaceImplementation3()403 {404 var implT = _compilation.GetTypeByMetadataName("TestClasses.Impl`1");405 VerifyRoundTrip(406 methodInfo: typeof(TestClasses.Impl<>).GetMethod("TestClasses.IImplementation<T>.ImplMethod2", PrivateBindingFlags),407 containingTypeSymbol: implT,408 methodSymbol: implT.FindMethod("TestClasses.IImplementation<T>.ImplMethod2"),409 managedTypeName: "TestClasses.Impl`1",410 managedMethodName: "'TestClasses.IImplementation<T>.ImplMethod2'`1(!0,!!0,System.String)");411 }412 [TestMethod]413 public void Inheritance1()414 {415 var outerPrime = _compilation.GetTypeByMetadataName("TestClasses.OuterPrime");416 VerifyRoundTrip(417 methodInfo: typeof(TestClasses.OuterPrime).GetMethod("Method3"),418 containingTypeSymbol: outerPrime,419 methodSymbol: outerPrime.FindMethod("Method3"),420 managedTypeName: "TestClasses.OuterPrime",421 managedMethodName: "Method3(System.String,System.Int32)");422 }423 [TestMethod]424 public void Inheritance2()425 {426 var outerPrimeZ = _compilation.GetTypeByMetadataName("TestClasses.OuterPrime`1");427 VerifyRoundTrip(428 methodInfo: typeof(TestClasses.OuterPrime<>).GetMethod("Method3"),429 containingTypeSymbol: outerPrimeZ,430 methodSymbol: outerPrimeZ.FindMethod("Method3"),431 managedTypeName: "TestClasses.OuterPrime`1",432 managedMethodName: "Method3`1(!0,!!0)");433 }434 [TestMethod]435 public void Inheritance3()436 {437 var outerPrimeYZ = _compilation.GetTypeByMetadataName("TestClasses.OuterPrime`2");438 VerifyRoundTrip(439 methodInfo: typeof(TestClasses.OuterPrime<,>).GetMethod("Method3"),440 containingTypeSymbol: outerPrimeYZ,441 methodSymbol: outerPrimeYZ.FindMethod("Method3"),442 managedTypeName: "TestClasses.OuterPrime`2",443 managedMethodName: "Method3`1(!1,!!0)");444 }445 [TestMethod]446 public void Inheritance4()447 {448 var outerString = _compilation.GetTypeByMetadataName("TestClasses.OuterString");449 VerifyRoundTrip(450 methodInfo: typeof(TestClasses.OuterString).GetMethod("Method3"),451 containingTypeSymbol: outerString,452 methodSymbol: outerString.FindMethod("Method3"),453 managedTypeName: "TestClasses.OuterString",454 managedMethodName: "Method3`1(System.String,!!0)");455 }456 [TestMethod]457 public void Overloads1()458 {459 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");460 VerifyRoundTrip(461 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0()"),462 containingTypeSymbol: overloads,463 methodSymbol: overloads.FindMethod("Overload0", 0),464 managedTypeName: "TestClasses.Overloads",465 managedMethodName: "Overload0");466 }467 [TestMethod]468 public void Overloads2()469 {470 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");471 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);472 VerifyRoundTrip(473 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0(Int32)"),474 containingTypeSymbol: overloads,475 methodSymbol: overloads.FindMethod("Overload0", 0, @int),476 managedTypeName: "TestClasses.Overloads",477 managedMethodName: "Overload0(System.Int32)");478 }479 [TestMethod]480 public void Overloads3()481 {482 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");483 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);484 VerifyRoundTrip(485 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0(Int32, TestClasses.Overloads)"),486 containingTypeSymbol: overloads,487 methodSymbol: overloads.FindMethod("Overload0", 0, @int, overloads),488 managedTypeName: "TestClasses.Overloads",489 managedMethodName: "Overload0(System.Int32,TestClasses.Overloads)");490 }491 [TestMethod]492 public void Overloads4()493 {494 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");495 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);496 var intptr = _compilation.CreatePointerTypeSymbol(@int);497 VerifyRoundTrip(498 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0(Int32*)"),499 containingTypeSymbol: overloads,500 methodSymbol: overloads.FindMethod("Overload0", 0, intptr),501 managedTypeName: "TestClasses.Overloads",502 managedMethodName: "Overload0(System.Int32*)");503 }504 [TestMethod]505 public void Overloads5()506 {507 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");508 var dynamic = _compilation.DynamicType;509 VerifyRoundTrip(510 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0(System.Object)"),511 containingTypeSymbol: overloads,512 methodSymbol: overloads.FindMethod("Overload0", 0, dynamic),513 managedTypeName: "TestClasses.Overloads",514 managedMethodName: "Overload0(System.Object)");515 }516 [TestMethod]517 public void Overloads6()518 {519 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");520 VerifyRoundTrip(521 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U](U)"),522 containingTypeSymbol: overloads,523 methodSymbol: overloads.FindMethod("Overload0", 1, 1, m => m.Parameters.Single().Type == m.TypeParameters.Single()),524 managedTypeName: "TestClasses.Overloads",525 managedMethodName: "Overload0`1(!!0)");526 }527 [TestMethod]528 public void Overloads7()529 {530 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");531 VerifyRoundTrip(532 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U]()"),533 containingTypeSymbol: overloads,534 methodSymbol: overloads.FindMethod("Overload0", 1),535 managedTypeName: "TestClasses.Overloads",536 managedMethodName: "Overload0`1");537 }538 [TestMethod]539 public void Overloads8()540 {541 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");542 VerifyRoundTrip(543 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U,T]()"),544 containingTypeSymbol: overloads,545 methodSymbol: overloads.FindMethod("Overload0", 2),546 managedTypeName: "TestClasses.Overloads",547 managedMethodName: "Overload0`2");548 }549 [TestMethod]550 public void Overloads9()551 {552 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");553 VerifyRoundTrip(554 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U](U[])"),555 containingTypeSymbol: overloads,556 methodSymbol: overloads.FindMethod("Overload0", 1, 1,557 m => m.Parameters.Single().Type is IArrayTypeSymbol arrayType &&558 arrayType.Rank == 1 &&559 arrayType.ElementType == m.TypeParameters.Single()),560 managedTypeName: "TestClasses.Overloads",561 managedMethodName: "Overload0`1(!!0[])");562 }563 [TestMethod]564 public void Overloads10()565 {566 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");567 VerifyRoundTrip(568 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U](U[][])"),569 containingTypeSymbol: overloads,570 methodSymbol: overloads.FindMethod("Overload0", 1, 1,571 m => m.Parameters.Single().Type is IArrayTypeSymbol arrayType &&572 arrayType.Rank == 1 &&573 arrayType.ElementType is IArrayTypeSymbol innerArrayType &&574 innerArrayType.Rank == 1 &&575 innerArrayType.ElementType == m.TypeParameters.Single()),576 managedTypeName: "TestClasses.Overloads",577 managedMethodName: "Overload0`1(!!0[][])");578 }579 [TestMethod]580 public void Overloads11()581 {582 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");583 VerifyRoundTrip(584 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U](U[,])"),585 containingTypeSymbol: overloads,586 methodSymbol: overloads.FindMethod("Overload0", 1, 1,587 m => m.Parameters.Single().Type is IArrayTypeSymbol arrayType &&588 arrayType.Rank == 2 &&589 arrayType.ElementType == m.TypeParameters.Single()),590 managedTypeName: "TestClasses.Overloads",591 managedMethodName: "Overload0`1(!!0[,])");592 }593 [TestMethod]594 public void Overloads12()595 {596 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");597 VerifyRoundTrip(598 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U](U[,,])"),599 containingTypeSymbol: overloads,600 methodSymbol: overloads.FindMethod("Overload0", 1, 1,601 m => m.Parameters.Single().Type is IArrayTypeSymbol arrayType &&602 arrayType.Rank == 3 &&603 arrayType.ElementType == m.TypeParameters.Single()),604 managedTypeName: "TestClasses.Overloads",605 managedMethodName: "Overload0`1(!!0[,,])");606 }607 [TestMethod]608 public void Overloads13()609 {610 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");611 var @int = _compilation.GetSpecialType(SpecialType.System_Int32);612 var listInt = _compilation.GetTypeByMetadataName("System.Collections.Generic.List`1").Construct(@int);613 VerifyRoundTrip(614 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U](System.Collections.Generic.List`1[System.Int32])"),615 containingTypeSymbol: overloads,616 methodSymbol: overloads.FindMethod("Overload0", 1, listInt),617 managedTypeName: "TestClasses.Overloads",618 managedMethodName: "Overload0`1(System.Collections.Generic.List`1<System.Int32>)");619 }620 [TestMethod]621 public void Overloads14()622 {623 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");624 var list = _compilation.GetTypeByMetadataName("System.Collections.Generic.List`1");625 VerifyRoundTrip(626 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U](System.Collections.Generic.List`1[U])"),627 containingTypeSymbol: overloads,628 methodSymbol: overloads.FindMethod("Overload0", 1, 1,629 m =>630 m.Parameters.Single().Type is INamedTypeSymbol p &&631 p.OriginalDefinition == list &&632 p.TypeArguments.Single() == m.TypeParameters.Single()),633 managedTypeName: "TestClasses.Overloads",634 managedMethodName: "Overload0`1(System.Collections.Generic.List`1<!!0>)");635 }636 [TestMethod]637 public void Overloads15()638 {639 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");640 var tuple2 = _compilation.GetTypeByMetadataName("System.Tuple`2");641 VerifyRoundTrip(642 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U,V](System.Tuple`2[U,V], System.Tuple`2[V,U])"),643 containingTypeSymbol: overloads,644 methodSymbol: overloads.FindMethod("Overload0", 2, 2,645 m =>646 m.Parameters.First() is INamedTypeSymbol p1 &&647 p1.OriginalDefinition == tuple2 &&648 p1.TypeArguments.SequenceEqual(m.TypeParameters) &&649 m.Parameters.Last() is INamedTypeSymbol p2 &&650 p2.OriginalDefinition == tuple2 &&651 p2.TypeArguments.SequenceEqual(m.TypeParameters.Reverse())),652 managedTypeName: "TestClasses.Overloads",653 managedMethodName: "Overload0`2(System.Tuple`2<!!0,!!1>,System.Tuple`2<!!1,!!0>)");654 }655 [TestMethod]656 public void Overloads16()657 {658 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");659 var tuple1 = _compilation.GetTypeByMetadataName("System.Tuple`1");660 var tuple2 = _compilation.GetTypeByMetadataName("System.Tuple`2");661 VerifyRoundTrip(662 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0(System.Tuple`1[System.Tuple`2[System.String[,],System.Int32]])"),663 containingTypeSymbol: overloads,664 methodSymbol: overloads.FindMethod("Overload0", 0, 1,665 m =>666 m.Parameters.Single().Type is INamedTypeSymbol p &&667 p.OriginalDefinition == tuple1 &&668 p.TypeArguments.Single() is INamedTypeSymbol t &&669 t.OriginalDefinition == tuple2),670 managedTypeName: "TestClasses.Overloads",671 managedMethodName: "Overload0(System.Tuple`1<System.Tuple`2<System.String[,],System.Int32>>)");672 }673 [TestMethod]674 public void Overloads17()675 {676 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");677 var tuple1 = _compilation.GetTypeByMetadataName("System.Tuple`1");678 var tuple2 = _compilation.GetTypeByMetadataName("System.Tuple`2");679 VerifyRoundTrip(680 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0(System.Tuple`2[System.Tuple`1[System.String],System.Tuple`1[System.Int32]])"),681 containingTypeSymbol: overloads,682 methodSymbol: overloads.FindMethod("Overload0", 0, 1,683 m =>684 m.Parameters.Single().Type is INamedTypeSymbol p &&685 p.OriginalDefinition == tuple2 &&686 p.TypeArguments.All(t => t.OriginalDefinition == tuple1)),687 managedTypeName: "TestClasses.Overloads",688 managedMethodName: "Overload0(System.Tuple`2<System.Tuple`1<System.String>,System.Tuple`1<System.Int32>>)");689 }690 [TestMethod]691 public void Overloads18()692 {693 var overloads = _compilation.GetTypeByMetadataName("TestClasses.Overloads");694 var tuple1 = _compilation.GetTypeByMetadataName("System.Tuple`1");695 VerifyRoundTrip(696 methodInfo: typeof(TestClasses.Overloads).FindMethod("Void Overload0[U](System.Tuple`1[System.Tuple`1[TestClasses.Outer`1+Inner`1[U,U]]])"),697 containingTypeSymbol: overloads,698 methodSymbol: overloads.FindMethod("Overload0", 1, 1,699 m =>700 m.Parameters.Single().Type is INamedTypeSymbol p &&701 p.OriginalDefinition == tuple1 &&702 p.TypeArguments.Single() is INamedTypeSymbol t &&703 t.OriginalDefinition == tuple1),704 managedTypeName: "TestClasses.Overloads",705 managedMethodName: "Overload0`1(System.Tuple`1<System.Tuple`1<TestClasses.Outer`1+Inner`1<!!0,!!0>>>)");706 }707 #region Helpers708 private void VerifyRoundTrip(709 MethodInfo methodInfo,710 INamedTypeSymbol containingTypeSymbol,711 IMethodSymbol methodSymbol,712 string managedTypeName,713 string managedMethodName)714 {715 VerifyRoundTripFromMethodInfo(methodInfo, managedTypeName, managedMethodName);716 VerifyRoundTripFromName(managedTypeName, managedMethodName, methodInfo);717 // VerifyRoundTripFromMethodSymbol(containingTypeSymbol, methodSymbol, managedTypeName, managedMethodName);718 // VerifyRoundTripFromName(managedTypeName, managedMethodName, containingTypeSymbol, methodSymbol);719 }720 private void VerifyRoundTripFromMethodInfo(721 MethodInfo methodInfo,722 string expectedManagedTypeName,723 string expectedManagedMethodName)724 {725 // Generate the fqn for the Reflection MethodInfo726 ManagedNameHelper.GetManagedName(methodInfo, out var managedTypeName, out var managedMethodName, out var hierarchyValues);727 Assert.AreEqual(expectedManagedTypeName, managedTypeName);728 Assert.AreEqual(expectedManagedMethodName, managedMethodName);729 // Lookup the Reflection MethodInfo using fullTypeName and fullMethodName730 var roundTrippedMethodInfo = ManagedNameHelper.GetMethod(731 Assembly.GetExecutingAssembly(),732 managedTypeName,733 managedMethodName);734 Assert.AreEqual(methodInfo.MetadataToken, roundTrippedMethodInfo.MetadataToken);735 }736 private void VerifyRoundTripFromName(737 string managedTypeName,738 string managedMethodName,739 MethodInfo expectedMethodInfo)740 {741 // Lookup the Reflection MethodInfo using fullTypeName and fullMethodName742 var methodInfo = ManagedNameHelper.GetMethod(743 Assembly.GetExecutingAssembly(),744 managedTypeName,745 managedMethodName);746 Assert.AreEqual(expectedMethodInfo.MetadataToken, methodInfo.MetadataToken);747 // Generate the fqn for the Reflection MethodInfo748 ManagedNameHelper.GetManagedName(749 methodInfo,750 out var roundTrippedFullTypeName,751 out var roundTrippedFullMethodName);752 Assert.AreEqual(managedTypeName, roundTrippedFullTypeName);753 Assert.AreEqual(managedMethodName, roundTrippedFullMethodName);754 }755 // private void VerifyRoundTripFromMethodSymbol(756 // INamedTypeSymbol containingTypeSymbol,757 // IMethodSymbol methodSymbol,758 // string expectedFullTypeName,759 // string expectedFullMethodName)760 // {761 // // Generate the fqn for the Roslyn IMethodSymbol762 // FullyQualifiedNameHelper.GetFullyQualifiedName(763 // containingTypeSymbol,764 // methodSymbol,765 // out var fullTypeName,766 // out var fullMethodName);767 // Assert.AreEqual(expectedFullTypeName, fullTypeName);768 // Assert.AreEqual(expectedFullMethodName, fullMethodName);769 // // Lookup the Roslyn ITypeSymbol and IMethodSymbol using fullTypeName and fullMethodName770 // var roundTrippedContainingTypeSymbol = _compilation.GetTypeByMetadataName(fullTypeName);771 // Assert.AreEqual(containingTypeSymbol.OriginalDefinition, roundTrippedContainingTypeSymbol.OriginalDefinition);772 // var roundTrippedMethodSymbol = FullyQualifiedNameHelper.GetMethodFromFullyQualifiedName(773 // _compilation,774 // fullTypeName,775 // fullMethodName);776 // Assert.AreEqual(methodSymbol.OriginalDefinition, roundTrippedMethodSymbol.OriginalDefinition);777 // }778 // private void VerifyRoundTripFromName(779 // string fullTypeName,780 // string fullMethodName,781 // INamedTypeSymbol expectedContainingTypeSymbol,782 // IMethodSymbol expectedMethodSymbol)783 // {784 // // Lookup the Roslyn ITypeSymbol and IMethodSymbol using fullTypeName and fullMethodName785 // var containingTypeSymbol = _compilation.GetTypeByMetadataName(fullTypeName);786 // 787 // Assert.AreEqual(expectedContainingTypeSymbol.OriginalDefinition, containingTypeSymbol.OriginalDefinition);788 // 789 // var methodSymbol = FullyQualifiedNameHelper.GetMethodFromFullyQualifiedName(790 // _compilation,791 // fullTypeName,792 // fullMethodName);793 // 794 // Assert.AreEqual(expectedMethodSymbol.OriginalDefinition, methodSymbol.OriginalDefinition);795 // 796 // // Generate the fqn for the Roslyn IMethodSymbol797 // FullyQualifiedNameHelper.GetFullyQualifiedName(798 // containingTypeSymbol,799 // methodSymbol,800 // out var roundTrippedFullTypeName,801 // out var roundTrippedFullMethodName);802 // 803 // Assert.AreEqual(fullTypeName, roundTrippedFullTypeName);804 // Assert.AreEqual(fullMethodName, roundTrippedFullMethodName);805 // }806 #endregion807 }808}...

Full Screen

Full Screen

OuterT

Using AI Code Generation

copy

Full Screen

1using TestClasses;2{3 static void Main()4 {5 OuterT o = new OuterT();6 o.display();7 }8}9{10 {11 public void display()12 {13 System.Console.WriteLine("OuterT class");14 }15 }16}17using TestClasses;18using OuterT = TestClasses.OuterT;19{20 static void Main()21 {22 OuterT o = new OuterT();23 o.display();24 }25}26{27 {28 public void display()29 {30 System.Console.WriteLine("OuterT class");31 }32 }33}34using TestClasses;35using OuterT = TestClasses.OuterT;36{37 static void Main()38 {39 OuterT o = new OuterT();

Full Screen

Full Screen

OuterT

Using AI Code Generation

copy

Full Screen

1using TestClasses;2class Test {3 public static void Main() {4 OuterT ot = new OuterT();5 ot.Display();6 }7}8namespace TestClasses {9 public class OuterT {10 public void Display() {11 System.Console.WriteLine("OuterT.Display()");12 }13 }14}15using TestClasses;16class Test {17 public static void Main() {18 OuterT ot = new OuterT();19 ot.Display();20 }21}22public class OuterT {23 public void Display() {24 System.Console.WriteLine("OuterT.Display()");25 }26}

Full Screen

Full Screen

OuterT

Using AI Code Generation

copy

Full Screen

1using TestClasses;2{3 {4 {5 public void Display()6 {7 Console.WriteLine("InnerT.Display()");8 }9 }10 }11}12{13 {14 static void Main()15 {16 OuterT.InnerT inObj = new OuterT.InnerT();17 inObj.Display();18 }19 }20}21using TestClasses;22{23 {24 {25 public void Display()26 {27 Console.WriteLine("InnerT.Display()");28 }29 }30 }31}32{33 {34 static void Main()35 {36 OuterT.InnerT inObj = new OuterT.InnerT();37 inObj.Display();38 }39 }40}41using TestClasses;42{43 {44 {45 public void Display()46 {47 Console.WriteLine("InnerT.Display()");48 }49 }50 }51}52{53 {54 static void Main()55 {56 OuterT.InnerT inObj = new OuterT.InnerT();57 inObj.Display();58 }59 }60}61using TestClasses;62{63 {64 {65 public void Display()66 {67 Console.WriteLine("InnerT.Display()");68 }69 }70 }71}72{73 {74 static void Main()75 {76 OuterT.InnerT inObj = new OuterT.InnerT();77 inObj.Display();78 }79 }80}81using TestClasses;82{83 {84 {85 public void Display()86 {87 Console.WriteLine("InnerT.Display()");88 }89 }90 }91}92{93 {94 static void Main()95 {

Full Screen

Full Screen

OuterT

Using AI Code Generation

copy

Full Screen

1using TestClasses;2{3public static void Main()4{5OuterT.InnerT obj = new OuterT.InnerT();6obj.Display();7}8}9{10}11using TestClasses;12{13public static void Main()14{15DerivedClass obj = new DerivedClass();16obj.Display();17}18}19{20void Method1()21{22}

Full Screen

Full Screen

OuterT

Using AI Code Generation

copy

Full Screen

1using TestClasses;2{3 public static void Main()4 {5 OuterT o = new OuterT();6 o.Display();7 }8}9OuterT.Display()10using TestClasses;11{12 public static void Main()13 {14 OuterT o = new OuterT();15 OuterT.InnerT i = o.new InnerT();16 i.Display();17 }18}19OuterT.InnerT.Display()20using TestClasses;21{22 public static void Main()23 {24 OuterT.InnerT i = new OuterT.InnerT();25 i.Display();26 }27}28OuterT.InnerT.Display()29{30 public static void Main()31 {32 var a = new { name = "John", age = 20 };33 System.Console.WriteLine(a.name + " " + a.age);34 }35}

Full Screen

Full Screen

OuterT

Using AI Code Generation

copy

Full Screen

1using TestClasses;2{3static void Main()4{5OuterT.InnerT obj = new OuterT.InnerT();6obj.Display();7}8}9using System;10{11{12{13{14public void Display()15{16Console.WriteLine("Hello from InnerInnerT");17}18}19}20}21}22using TestClasses;23{24static void Main()25{26OuterT.InnerT.InnerInnerT obj = new OuterT.InnerT.InnerInnerT();27obj.Display();28}29}30using System;31{32{33{34public void Display()35{36Console.WriteLine("Hello from InnerT");37}38}39}40}41using TestClasses;42{43static void Main()44{45IOuterT.InnerT obj = new IOuterT.InnerT();46obj.Display();47}48}49using System;50{51delegate void DOuterT();52{53{54public void Display()55{56Console.WriteLine("Hello from InnerT");57}58}59}60}61using TestClasses;62{63static void Main()64{65OuterT.InnerT obj = new OuterT.InnerT();66obj.Display();67}68}69using System;70{71{72{73public void Display()74{75Console.WriteLine("Hello from InnerT");76}77}78}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Vstest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in OuterT

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful