How to use AssemblyInfo method of Xunit.v3.Mocks class

Best Xunit code snippet using Xunit.v3.Mocks.AssemblyInfo

Mocks.cs

Source:Mocks.cs Github

copy

Full Screen

...12using TestMethodDisplay = Xunit.Sdk.TestMethodDisplay;13using TestMethodDisplayOptions = Xunit.Sdk.TestMethodDisplayOptions;14public static class Mocks15{16 public static IAssemblyInfo AssemblyInfo(17 ITypeInfo[]? types = null,18 IReflectionAttributeInfo[]? attributes = null,19 string? assemblyFileName = null)20 {21 attributes = attributes ?? new IReflectionAttributeInfo[0];22 var result = Substitute.For<IAssemblyInfo, InterfaceProxy<IAssemblyInfo>>();23 result.Name.Returns(assemblyFileName == null ? "assembly:" + Guid.NewGuid().ToString("n") : Path.GetFileNameWithoutExtension(assemblyFileName));24 result.AssemblyPath.Returns(assemblyFileName);25 result.GetType("").ReturnsForAnyArgs(types?.FirstOrDefault());26 result.GetTypes(true).ReturnsForAnyArgs(types ?? new ITypeInfo[0]);27 result.GetCustomAttributes("").ReturnsForAnyArgs(callInfo => LookupAttribute(callInfo.Arg<string>(), attributes));28 return result;29 }30 public static IReflectionAttributeInfo CollectionAttribute(string collectionName)31 {32 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();33 result.Attribute.Returns(new CollectionAttribute(collectionName));34 result.GetConstructorArguments().Returns(new[] { collectionName });35 return result;36 }37 public static IReflectionAttributeInfo CollectionBehaviorAttribute(38 CollectionBehavior? collectionBehavior = null,39 bool disableTestParallelization = false,40 int maxParallelThreads = 0)41 {42 CollectionBehaviorAttribute attribute;43 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();44 if (collectionBehavior.HasValue)45 {46 attribute = new CollectionBehaviorAttribute(collectionBehavior.GetValueOrDefault());47 result.GetConstructorArguments().Returns(new object[] { collectionBehavior });48 }49 else50 {51 attribute = new CollectionBehaviorAttribute();52 result.GetConstructorArguments().Returns(new object[0]);53 }54 attribute.DisableTestParallelization = disableTestParallelization;55 attribute.MaxParallelThreads = maxParallelThreads;56 result.Attribute.Returns(attribute);57 result.GetNamedArgument<bool>("DisableTestParallelization").Returns(disableTestParallelization);58 result.GetNamedArgument<int>("MaxParallelThreads").Returns(maxParallelThreads);59 return result;60 }61 public static IReflectionAttributeInfo CollectionBehaviorAttribute(62 Type factoryType,63 bool disableTestParallelization = false,64 int maxParallelThreads = 0)65 {66 var attribute = new CollectionBehaviorAttribute(factoryType)67 {68 DisableTestParallelization = disableTestParallelization,69 MaxParallelThreads = maxParallelThreads70 };71 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();72 result.Attribute.Returns(attribute);73 result.GetNamedArgument<bool>("DisableTestParallelization").Returns(disableTestParallelization);74 result.GetNamedArgument<int>("MaxParallelThreads").Returns(maxParallelThreads);75 result.GetConstructorArguments().Returns(new object[] { factoryType });76 return result;77 }78 public static IReflectionAttributeInfo CollectionBehaviorAttribute(79 string factoryTypeName,80 string factoryAssemblyName,81 bool disableTestParallelization = false,82 int maxParallelThreads = 0)83 {84 var attribute = new CollectionBehaviorAttribute(factoryTypeName, factoryAssemblyName)85 {86 DisableTestParallelization = disableTestParallelization,87 MaxParallelThreads = maxParallelThreads88 };89 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();90 result.Attribute.Returns(attribute);91 result.GetNamedArgument<bool>("DisableTestParallelization").Returns(disableTestParallelization);92 result.GetNamedArgument<int>("MaxParallelThreads").Returns(maxParallelThreads);93 result.GetConstructorArguments().Returns(new object[] { factoryTypeName, factoryAssemblyName });94 return result;95 }96 public static IReflectionAttributeInfo CollectionDefinitionAttribute(string collectionName)97 {98 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();99 result.Attribute.Returns(new CollectionDefinitionAttribute(collectionName));100 result.GetConstructorArguments().Returns(new[] { collectionName });101 return result;102 }103 public static IReflectionAttributeInfo DataAttribute(IEnumerable<object[]>? data = null)104 {105 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();106 var dataAttribute = Substitute.For<DataAttribute>();107 dataAttribute.GetData(null!).ReturnsForAnyArgs(data);108 result.Attribute.Returns(dataAttribute);109 return result;110 }111 public static ExecutionErrorTestCase ExecutionErrorTestCase(112 string message,113 IMessageSink? diagnosticMessageSink = null)114 {115 var testMethod = TestMethod();116 return new ExecutionErrorTestCase(117 diagnosticMessageSink ?? new NullMessageSink(),118 TestMethodDisplay.ClassAndMethod,119 TestMethodDisplayOptions.None,120 testMethod,121 message122 );123 }124 public static IReflectionAttributeInfo FactAttribute(125 string? displayName = null,126 string? skip = null,127 int timeout = 0)128 {129 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();130 result.Attribute.Returns(new FactAttribute { DisplayName = displayName, Skip = skip, Timeout = timeout });131 result.GetNamedArgument<string>("DisplayName").Returns(displayName);132 result.GetNamedArgument<string>("Skip").Returns(skip);133 result.GetNamedArgument<int>("Timeout").Returns(timeout);134 return result;135 }136 static IEnumerable<IAttributeInfo> LookupAttribute(137 string fullyQualifiedTypeName,138 IReflectionAttributeInfo[]? attributes)139 {140 if (attributes == null)141 return Enumerable.Empty<IAttributeInfo>();142 var attributeType = Type.GetType(fullyQualifiedTypeName);143 if (attributeType == null)144 return Enumerable.Empty<IAttributeInfo>();145 return attributes.Where(attribute => attributeType.IsAssignableFrom(attribute.Attribute.GetType())).ToList();146 }147 public static IMethodInfo MethodInfo(148 string? methodName = null,149 IReflectionAttributeInfo[]? attributes = null,150 IParameterInfo[]? parameters = null,151 ITypeInfo? type = null,152 ITypeInfo? returnType = null,153 bool isAbstract = false,154 bool isPublic = true,155 bool isStatic = false)156 {157 var result = Substitute.For<IMethodInfo, InterfaceProxy<IMethodInfo>>();158 attributes ??= new IReflectionAttributeInfo[0];159 parameters ??= new IParameterInfo[0];160 result.IsAbstract.Returns(isAbstract);161 result.IsPublic.Returns(isPublic);162 result.IsStatic.Returns(isStatic);163 result.Name.Returns(methodName ?? "method:" + Guid.NewGuid().ToString("n"));164 result.ReturnType.Returns(returnType);165 result.Type.Returns(type);166 result.GetCustomAttributes("").ReturnsForAnyArgs(callInfo => LookupAttribute(callInfo.Arg<string>(), attributes));167 result.GetParameters().Returns(parameters);168 return result;169 }170 public static IParameterInfo ParameterInfo(string name)171 {172 var result = Substitute.For<IParameterInfo, InterfaceProxy<IParameterInfo>>();173 result.Name.Returns(name);174 return result;175 }176 public static IReflectionMethodInfo ReflectionMethodInfo<TClass>(string methodName)177 {178 return Reflector.Wrap(typeof(TClass).GetMethod(methodName)!);179 }180 public static IReflectionTypeInfo ReflectionTypeInfo<TClass>()181 {182 return Reflector.Wrap(typeof(TClass));183 }184 public static IRunnerReporter RunnerReporter(185 string? runnerSwitch = null,186 string? description = null,187 bool isEnvironmentallyEnabled = false,188 IMessageSinkWithTypes? messageSink = null)189 {190 var result = Substitute.For<IRunnerReporter, InterfaceProxy<IRunnerReporter>>();191 result.Description.Returns(description ?? "The runner reporter description");192 result.IsEnvironmentallyEnabled.ReturnsForAnyArgs(isEnvironmentallyEnabled);193 result.RunnerSwitch.Returns(runnerSwitch);194 var dualSink = MessageSinkAdapter.Wrap(messageSink ?? Substitute.For<IMessageSinkWithTypes, InterfaceProxy<IMessageSinkWithTypes>>());195 result.CreateMessageHandler(null!).ReturnsForAnyArgs(dualSink);196 return result;197 }198 public static ITest Test(199 ITestCase testCase,200 string displayName)201 {202 var result = Substitute.For<ITest, InterfaceProxy<ITest>>();203 result.DisplayName.Returns(displayName);204 result.TestCase.Returns(testCase);205 return result;206 }207 public static ITestAssembly TestAssembly(IReflectionAttributeInfo[] attributes)208 {209 var assemblyInfo = AssemblyInfo(attributes: attributes);210 var result = Substitute.For<ITestAssembly, InterfaceProxy<ITestAssembly>>();211 result.Assembly.Returns(assemblyInfo);212 return result;213 }214 public static ITestAssembly TestAssembly(215 string assemblyFileName,216 string? configFileName = null,217 ITypeInfo[]? types = null,218 IReflectionAttributeInfo[]? attributes = null)219 {220 var assemblyInfo = AssemblyInfo(types, attributes, assemblyFileName);221 var result = Substitute.For<ITestAssembly, InterfaceProxy<ITestAssembly>>();222 result.Assembly.Returns(assemblyInfo);223 result.ConfigFileName.Returns(configFileName);224 return result;225 }226 public static TestAssembly TestAssembly(227 Assembly? assembly = null,228 string? configFileName = null)229 {230#if NETFRAMEWORK231 if (configFileName == null)232 configFileName = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;233#endif234 return new TestAssembly(Reflector.Wrap(assembly ?? typeof(Mocks).Assembly), configFileName);235 }236 public static ITestAssemblyDiscoveryFinished TestAssemblyDiscoveryFinished(237 bool diagnosticMessages = false,238 int toRun = 42,239 int discovered = 2112)240 {241 var assembly = new XunitProjectAssembly { AssemblyFilename = "testAssembly.dll", ConfigFilename = "testAssembly.dll.config" };242 var config = new TestAssemblyConfiguration { DiagnosticMessages = diagnosticMessages, ShadowCopy = true };243 var result = Substitute.For<ITestAssemblyDiscoveryFinished, InterfaceProxy<ITestAssemblyDiscoveryFinished>>();244 result.Assembly.Returns(assembly);245 result.DiscoveryOptions.Returns(TestFrameworkOptions.ForDiscovery(config));246 result.TestCasesDiscovered.Returns(discovered);247 result.TestCasesToRun.Returns(toRun);248 return result;249 }250 public static ITestAssemblyDiscoveryStarting TestAssemblyDiscoveryStarting(251 bool diagnosticMessages = false,252 AppDomainOption appDomain = AppDomainOption.Disabled,253 bool shadowCopy = false)254 {255 var assembly = new XunitProjectAssembly { AssemblyFilename = "testAssembly.dll", ConfigFilename = "testAssembly.dll.config" };256 var config = new TestAssemblyConfiguration { DiagnosticMessages = diagnosticMessages, MethodDisplay = Xunit.TestMethodDisplay.ClassAndMethod, MaxParallelThreads = 42, ParallelizeTestCollections = true, ShadowCopy = shadowCopy };257 var result = Substitute.For<ITestAssemblyDiscoveryStarting, InterfaceProxy<ITestAssemblyDiscoveryStarting>>();258 result.AppDomain.Returns(appDomain);259 result.Assembly.Returns(assembly);260 result.DiscoveryOptions.Returns(TestFrameworkOptions.ForDiscovery(config));261 result.ShadowCopy.Returns(shadowCopy);262 return result;263 }264 public static ITestAssemblyExecutionFinished TestAssemblyExecutionFinished(265 bool diagnosticMessages = false,266 int total = 2112,267 int failed = 42,268 int skipped = 8,269 int errors = 6,270 decimal time = 123.456M)271 {272 var assembly = new XunitProjectAssembly { AssemblyFilename = "testAssembly.dll", ConfigFilename = "testAssembly.dll.config" };273 var config = new TestAssemblyConfiguration { DiagnosticMessages = diagnosticMessages, ShadowCopy = true };274 var summary = new ExecutionSummary { Total = total, Failed = failed, Skipped = skipped, Errors = errors, Time = time };275 var result = Substitute.For<ITestAssemblyExecutionFinished, InterfaceProxy<ITestAssemblyExecutionFinished>>();276 result.Assembly.Returns(assembly);277 result.ExecutionOptions.Returns(TestFrameworkOptions.ForExecution(config));278 result.ExecutionSummary.Returns(summary);279 return result;280 }281 public static ITestAssemblyExecutionStarting TestAssemblyExecutionStarting(282 bool diagnosticMessages = false,283 string? assemblyFilename = null)284 {285 var assembly = new XunitProjectAssembly { AssemblyFilename = assemblyFilename ?? "testAssembly.dll", ConfigFilename = "testAssembly.dll.config" };286 var config = new TestAssemblyConfiguration { DiagnosticMessages = diagnosticMessages, MethodDisplay = Xunit.TestMethodDisplay.ClassAndMethod, MaxParallelThreads = 42, ParallelizeTestCollections = true, ShadowCopy = true };287 var result = Substitute.For<ITestAssemblyExecutionStarting, InterfaceProxy<ITestAssemblyExecutionStarting>>();288 result.Assembly.Returns(assembly);289 result.ExecutionOptions.Returns(TestFrameworkOptions.ForExecution(config));290 return result;291 }292 public static ITestAssemblyFinished TestAssemblyFinished(293 int testsRun = 2112,294 int testsFailed = 42,295 int testsSkipped = 6,296 decimal executionTime = 123.4567M)297 {298 var testAssembly = TestAssembly("testAssembly.dll");299 var result = Substitute.For<ITestAssemblyFinished, InterfaceProxy<ITestAssemblyFinished>>();300 result.TestAssembly.Returns(testAssembly);301 result.TestsRun.Returns(testsRun);302 result.TestsFailed.Returns(testsFailed);303 result.TestsSkipped.Returns(testsSkipped);304 result.ExecutionTime.Returns(executionTime);305 return result;306 }307 public static ITestAssemblyStarting TestAssemblyStarting()308 {309 var testAssembly = TestAssembly("testAssembly.dll");310 var result = Substitute.For<ITestAssemblyStarting, InterfaceProxy<ITestAssemblyStarting>>();311 result.TestAssembly.Returns(testAssembly);312 return result;313 }314 public static ITestCase TestCase(ITestCollection? collection = null)315 {316 if (collection == null)317 collection = TestCollection();318 var result = Substitute.For<ITestCase, InterfaceProxy<ITestCase>>();319 result.TestMethod.TestClass.TestCollection.Returns(collection);320 return result;321 }322 public static ITestCase TestCase(ITestMethod testMethod)323 {324 var result = Substitute.For<ITestCase, InterfaceProxy<ITestCase>>();325 result.TestMethod.Returns(testMethod);326 return result;327 }328 public static ITestCase TestCase<TClassUnderTest>(329 string methodName,330 string? displayName = null,331 string? skipReason = null,332 string? uniqueID = null,333 string? fileName = null,334 int? lineNumber = null)335 {336 return TestCase(typeof(TClassUnderTest), methodName, displayName, skipReason, uniqueID, fileName, lineNumber);337 }338 public static ITestCase TestCase(339 Type type,340 string methodName,341 string? displayName = null,342 string? skipReason = null,343 string? uniqueID = null,344 string? fileName = null,345 int? lineNumber = null)346 {347 var testMethod = TestMethod(type, methodName);348 var traits = GetTraits(testMethod.Method);349 var result = Substitute.For<ITestCase, InterfaceProxy<ITestCase>>();350 result.DisplayName.Returns(displayName ?? $"{type}.{methodName}");351 result.SkipReason.Returns(skipReason);352 result.TestMethod.Returns(testMethod);353 result.Traits.Returns(traits);354 result.UniqueID.Returns(uniqueID ?? Guid.NewGuid().ToString());355 if (fileName != null && lineNumber != null)356 {357 var sourceInfo = new Xunit.SourceInformation { FileName = fileName, LineNumber = lineNumber };358 result.SourceInformation.Returns(sourceInfo);359 }360 return result;361 }362 public static IReflectionAttributeInfo TestCaseOrdererAttribute(string typeName, string assemblyName)363 {364 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();365 result.Attribute.Returns(new TestCaseOrdererAttribute(typeName, assemblyName));366 result.GetConstructorArguments().Returns(new object[] { typeName, assemblyName });367 return result;368 }369 public static IReflectionAttributeInfo TestCaseOrdererAttribute(Type type)370 {371 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();372 result.Attribute.Returns(new TestCaseOrdererAttribute(type));373 result.GetConstructorArguments().Returns(new object[] { type });374 return result;375 }376 public static IReflectionAttributeInfo TestCaseOrdererAttribute<TOrderer>() =>377 TestCaseOrdererAttribute(typeof(TOrderer));378 public static ITestClass TestClass(379 string? typeName = null,380 IReflectionAttributeInfo[]? attributes = null)381 {382 var testCollection = TestCollection();383 var typeInfo = TypeInfo(typeName, attributes: attributes);384 var result = Substitute.For<ITestClass, InterfaceProxy<ITestClass>>();385 result.Class.Returns(typeInfo);386 result.TestCollection.Returns(testCollection);387 return result;388 }389 public static TestClass TestClass(390 Type type,391 ITestCollection? collection = null)392 {393 if (collection == null)394 collection = TestCollection(type.Assembly);395 return new TestClass(collection, Reflector.Wrap(type));396 }397 public static TestCollection TestCollection(398 Assembly? assembly = null,399 ITypeInfo? definition = null,400 string? displayName = null)401 {402 if (assembly == null)403 assembly = typeof(Mocks).Assembly;404 if (displayName == null)405 displayName = "Mock test collection for " + assembly.CodeBase;406 return new TestCollection(TestAssembly(assembly), definition, displayName);407 }408 public static ITestCollectionFinished TestCollectionFinished(409 string displayName = "Display Name",410 int testsRun = 2112,411 int testsFailed = 42,412 int testsSkipped = 6,413 decimal executionTime = 123.4567M)414 {415 var result = Substitute.For<ITestCollectionFinished, InterfaceProxy<ITestCollectionFinished>>();416 result.TestsRun.Returns(testsRun);417 result.TestsFailed.Returns(testsFailed);418 result.TestsSkipped.Returns(testsSkipped);419 result.ExecutionTime.Returns(executionTime);420 result.TestCollection.DisplayName.Returns(displayName);421 return result;422 }423 public static ITestCollectionStarting TestCollectionStarting()424 {425 var result = Substitute.For<ITestCollectionStarting, InterfaceProxy<ITestCollectionStarting>>();426 result.TestCollection.DisplayName.Returns("Display Name");427 return result;428 }429 public static IReflectionAttributeInfo TestCollectionOrdererAttribute(string typeName, string assemblyName)430 {431 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();432 result.Attribute.Returns(new TestCollectionOrdererAttribute(typeName, assemblyName));433 result.GetConstructorArguments().Returns(new object[] { typeName, assemblyName });434 return result;435 }436 public static IReflectionAttributeInfo TestCollectionOrdererAttribute(Type type)437 {438 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();439 result.Attribute.Returns(new TestCollectionOrdererAttribute(type));440 result.GetConstructorArguments().Returns(new object[] { type });441 return result;442 }443 public static IReflectionAttributeInfo TestCollectionOrdererAttribute<TOrderer>() =>444 TestCollectionOrdererAttribute(typeof(TOrderer));445 public static ITestFailed TestFailed(446 Type type,447 string methodName,448 string? displayName = null,449 string? output = null,450 decimal executionTime = 0M,451 Exception? ex = null)452 {453 var testCase = TestCase(type, methodName);454 var test = Test(testCase, displayName ?? "NO DISPLAY NAME");455 var failureInfo = Xunit.Sdk.ExceptionUtility.ConvertExceptionToFailureInformation(ex ?? new Exception());456 var result = Substitute.For<ITestFailed, InterfaceProxy<ITestFailed>>();457 result.ExceptionParentIndices.Returns(failureInfo.ExceptionParentIndices);458 result.ExceptionTypes.Returns(failureInfo.ExceptionTypes);459 result.ExecutionTime.Returns(executionTime);460 result.Messages.Returns(failureInfo.Messages);461 result.Output.Returns(output);462 result.StackTraces.Returns(failureInfo.StackTraces);463 result.TestCase.Returns(testCase);464 result.Test.Returns(test);465 return result;466 }467 public static ITestFailed TestFailed(468 string displayName,469 decimal executionTime,470 string? exceptionType = null,471 string? exceptionMessage = null,472 string? stackTrace = null,473 string? output = null)474 {475 var testCase = TestCase();476 var test = Test(testCase, displayName);477 var result = Substitute.For<ITestFailed, InterfaceProxy<ITestFailed>>();478 result.ExceptionParentIndices.Returns(new[] { -1 });479 result.ExceptionTypes.Returns(new[] { exceptionType });480 result.ExecutionTime.Returns(executionTime);481 result.Messages.Returns(new[] { exceptionMessage });482 result.Output.Returns(output);483 result.StackTraces.Returns(new[] { stackTrace });484 result.TestCase.Returns(testCase);485 result.Test.Returns(test);486 return result;487 }488 public static IReflectionAttributeInfo TestFrameworkAttribute(Type type)489 {490 var attribute = Activator.CreateInstance(type);491 if (attribute == null)492 throw new InvalidOperationException($"Unable to create attribute instance: '{type.FullName}'");493 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();494 result.Attribute.Returns(attribute);495 result.GetCustomAttributes(null).ReturnsForAnyArgs(496 callInfo => LookupAttribute(497 callInfo.Arg<string>(),498 CustomAttributeData.GetCustomAttributes(attribute.GetType()).Select(x => Reflector.Wrap(x)).ToArray()499 )500 );501 return result;502 }503 public static ITestMethod TestMethod(504 string? typeName = null,505 string? methodName = null,506 string? displayName = null,507 string? skip = null,508 int timeout = 0,509 IEnumerable<IParameterInfo>? parameters = null,510 IEnumerable<IReflectionAttributeInfo>? classAttributes = null,511 IEnumerable<IReflectionAttributeInfo>? methodAttributes = null)512 {513 if (classAttributes == null)514 classAttributes = Enumerable.Empty<IReflectionAttributeInfo>();515 if (methodAttributes == null)516 methodAttributes = Enumerable.Empty<IReflectionAttributeInfo>();517 if (parameters == null)518 parameters = Enumerable.Empty<IParameterInfo>();519 var factAttribute = methodAttributes.FirstOrDefault(attr => typeof(FactAttribute).IsAssignableFrom(attr.Attribute.GetType()));520 if (factAttribute == null)521 {522 factAttribute = FactAttribute(displayName, skip, timeout);523 methodAttributes = methodAttributes.Concat(new[] { factAttribute });524 }525 var testClass = TestClass(typeName, attributes: classAttributes.ToArray());526 var methodInfo = MethodInfo(methodName, methodAttributes.ToArray(), parameters.ToArray(), testClass.Class);527 var result = Substitute.For<ITestMethod, InterfaceProxy<ITestMethod>>();528 result.Method.Returns(methodInfo);529 result.TestClass.Returns(testClass);530 return result;531 }532 public static TestMethod TestMethod(533 Type type,534 string methodName,535 ITestCollection? collection = null)536 {537 var @class = TestClass(type, collection);538 var methodInfo = type.GetMethod(methodName);539 if (methodInfo == null)540 throw new Exception($"Unknown method: {type.FullName}.{methodName}");541 return new TestMethod(@class, Reflector.Wrap(methodInfo));542 }543 public static ITestPassed TestPassed(544 Type type,545 string methodName,546 string? displayName = null,547 string? output = null,548 decimal executionTime = 0M)549 {550 var testCase = TestCase(type, methodName);551 var test = Test(testCase, displayName ?? "NO DISPLAY NAME");552 var result = Substitute.For<ITestPassed, InterfaceProxy<ITestPassed>>();553 result.ExecutionTime.Returns(executionTime);554 result.Output.Returns(output);555 result.TestCase.Returns(testCase);556 result.Test.Returns(test);557 return result;558 }559 public static ITestPassed TestPassed(560 string displayName,561 string? output = null)562 {563 var testCase = TestCase();564 var test = Test(testCase, displayName);565 var result = Substitute.For<ITestPassed, InterfaceProxy<ITestPassed>>();566 result.Test.Returns(test);567 result.ExecutionTime.Returns(1.2345M);568 result.Output.Returns(output);569 return result;570 }571 public static ITestResultMessage TestResult<TClassUnderTest>(572 string methodName,573 string displayName,574 decimal executionTime)575 {576 var testCase = TestCase<TClassUnderTest>(methodName);577 var test = Test(testCase, displayName);578 var result = Substitute.For<ITestResultMessage, InterfaceProxy<ITestResultMessage>>();579 result.TestCase.Returns(testCase);580 result.Test.Returns(test);581 result.ExecutionTime.Returns(executionTime);582 return result;583 }584 public static ITestSkipped TestSkipped(585 Type type,586 string methodName,587 string? displayName = null,588 string? output = null,589 decimal executionTime = 0M,590 string? skipReason = null)591 {592 var testCase = TestCase(type, methodName);593 var test = Test(testCase, displayName ?? "NO DISPLAY NAME");594 var result = Substitute.For<ITestSkipped, InterfaceProxy<ITestSkipped>>();595 result.ExecutionTime.Returns(executionTime);596 result.Output.Returns(output);597 result.Reason.Returns(skipReason);598 result.TestCase.Returns(testCase);599 result.Test.Returns(test);600 return result;601 }602 public static ITestSkipped TestSkipped(603 string displayName,604 string? skipReason = null)605 {606 var testCase = TestCase();607 var test = Test(testCase, displayName);608 var result = Substitute.For<ITestSkipped, InterfaceProxy<ITestSkipped>>();609 result.Reason.Returns(skipReason);610 result.TestCase.Returns(testCase);611 result.Test.Returns(test);612 return result;613 }614 public static ITestStarting TestStarting(string displayName)615 {616 var testCase = TestCase();617 var test = Test(testCase, displayName);618 var result = Substitute.For<ITestStarting, InterfaceProxy<ITestStarting>>();619 result.Test.Returns(test);620 return result;621 }622 public static IReflectionAttributeInfo TheoryAttribute(623 string? displayName = null,624 string? skip = null,625 int timeout = 0)626 {627 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();628 result.Attribute.Returns(new TheoryAttribute { DisplayName = displayName, Skip = skip });629 result.GetNamedArgument<string>("DisplayName").Returns(displayName);630 result.GetNamedArgument<string>("Skip").Returns(skip);631 result.GetNamedArgument<int>("Timeout").Returns(timeout);632 return result;633 }634 public static IReflectionAttributeInfo TraitAttribute<T>()635 where T : Attribute, new()636 {637 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();638 result.Attribute.Returns(new T());639 return result;640 }641 public static IReflectionAttributeInfo TraitAttribute(642 string name,643 string value)644 {645 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();646 var traitDiscovererAttributes = new[] { TraitDiscovererAttribute() };647 result.GetCustomAttributes(typeof(TraitDiscovererAttribute)).Returns(traitDiscovererAttributes);648 result.Attribute.Returns(new TraitAttribute(name, value));649 result.GetConstructorArguments().Returns(new object[] { name, value });650 return result;651 }652 public static IAttributeInfo TraitDiscovererAttribute(653 string typeName = "Xunit.Sdk.TraitDiscoverer",654 string assemblyName = "xunit.v3.core")655 {656 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();657 result.Attribute.Returns(new TraitDiscovererAttribute(typeName, assemblyName));658 result.GetConstructorArguments().Returns(new object[] { typeName, assemblyName });659 return result;660 }661 public static IAttributeInfo TraitDiscovererAttribute(Type discovererType)662 {663 var result = Substitute.For<IReflectionAttributeInfo, InterfaceProxy<IReflectionAttributeInfo>>();664 result.Attribute.Returns(new TraitDiscovererAttribute(discovererType));665 result.GetConstructorArguments().Returns(new object[] { discovererType });666 return result;667 }668 public static IAttributeInfo TraitDiscovererAttribute<TDiscoverer>() =>669 TraitDiscovererAttribute(typeof(TDiscoverer));670 public static ITypeInfo TypeInfo(671 string? typeName = null,672 IMethodInfo[]? methods = null,673 IReflectionAttributeInfo[]? attributes = null,674 string? assemblyFileName = null)675 {676 var result = Substitute.For<ITypeInfo, InterfaceProxy<ITypeInfo>>();677 result.Name.Returns(typeName ?? "type:" + Guid.NewGuid().ToString("n"));678 result.GetMethods(false).ReturnsForAnyArgs(methods ?? new IMethodInfo[0]);679 var assemblyInfo = AssemblyInfo(assemblyFileName: assemblyFileName);680 result.Assembly.Returns(assemblyInfo);681 result.GetCustomAttributes("").ReturnsForAnyArgs(callInfo => LookupAttribute(callInfo.Arg<string>(), attributes));682 return result;683 }684 public static XunitTestCase XunitTestCase<TClassUnderTest>(685 string methodName,686 ITestCollection? collection = null,687 object[]? testMethodArguments = null,688 IMessageSink? diagnosticMessageSink = null)689 {690 var method = TestMethod(typeof(TClassUnderTest), methodName, collection);691 return new XunitTestCase(diagnosticMessageSink ?? new NullMessageSink(), TestMethodDisplay.ClassAndMethod, TestMethodDisplayOptions.None, method, testMethodArguments);692 }693 public static XunitTheoryTestCase XunitTheoryTestCase<TClassUnderTest>(...

Full Screen

Full Screen

XunitTestFrameworkDiscovererTests.cs

Source:XunitTestFrameworkDiscovererTests.cs Github

copy

Full Screen

...196 CollectionBehavior behavior,197 Type expectedFactoryType)198 {199 var behaviorAttribute = Mocks.CollectionBehaviorAttribute(behavior);200 var assembly = Mocks.AssemblyInfo(attributes: new[] { behaviorAttribute });201 var discoverer = TestableXunitTestFrameworkDiscoverer.Create(assembly);202 Assert.IsType(expectedFactoryType, discoverer.TestCollectionFactory);203 }204 [Fact]205 public static void ValidCustomFactory()206 {207 var behaviorAttribute = Mocks.CollectionBehaviorAttribute<CustomTestCollectionFactory>();208 var assembly = Mocks.AssemblyInfo(attributes: new[] { behaviorAttribute });209 var discoverer = TestableXunitTestFrameworkDiscoverer.Create(assembly);210 Assert.IsType<CustomTestCollectionFactory>(discoverer.TestCollectionFactory);211 }212 [Fact]213 public static void InvalidCustomFactoryFallsBackToDefault()214 {215 var spyMessageSink = SpyMessageSink.Capture();216 TestContext.Current!.DiagnosticMessageSink = spyMessageSink;217 var behaviorAttribute = Mocks.CollectionBehaviorAttribute<object>();218 var assembly = Mocks.AssemblyInfo(attributes: new[] { behaviorAttribute });219 var discoverer = TestableXunitTestFrameworkDiscoverer.Create(assembly);220 Assert.IsType<CollectionPerClassTestCollectionFactory>(discoverer.TestCollectionFactory);221 var message = Assert.Single(spyMessageSink.Messages);222 var diagMessage = Assert.IsType<_DiagnosticMessage>(message);223 Assert.Equal("Test collection factory type 'System.Object' does not implement IXunitTestCollectionFactory", diagMessage.Message);224 }225 }226 public static class TestFrameworkDisplayName227 {228 [Fact]229 public static void Defaults()230 {231 var discoverer = TestableXunitTestFrameworkDiscoverer.Create();232 Assert.Matches(@"xUnit.net v3 \d+\.\d+\.\d+(-pre\.\d+(-dev)?(\+[0-9a-f]+)?)? \[collection-per-class, parallel\]", discoverer.TestFrameworkDisplayName);233 }234 [Fact]235 public static void CollectionPerAssembly()236 {237 var behaviorAttribute = Mocks.CollectionBehaviorAttribute(CollectionBehavior.CollectionPerAssembly);238 var assembly = Mocks.AssemblyInfo(attributes: new[] { behaviorAttribute });239 var discoverer = TestableXunitTestFrameworkDiscoverer.Create(assembly);240 Assert.Matches(@"xUnit.net v3 \d+\.\d+\.\d+(-pre\.\d+(-dev)?(\+[0-9a-f]+)?)? \[collection-per-assembly, parallel\]", discoverer.TestFrameworkDisplayName);241 }242 [Fact]243 public static void CustomCollectionFactory()244 {245 var behaviorAttribute = Mocks.CollectionBehaviorAttribute<CustomTestCollectionFactory>();246 var assembly = Mocks.AssemblyInfo(attributes: new[] { behaviorAttribute });247 var discoverer = TestableXunitTestFrameworkDiscoverer.Create(assembly);248 Assert.Matches(@"xUnit.net v3 \d+\.\d+\.\d+(-pre\.\d+(-dev)?(\+[0-9a-f]+)?)? \[my-custom-test-collection-factory, parallel\]", discoverer.TestFrameworkDisplayName);249 }250 [Fact]251 public static void NonParallel()252 {253 var behaviorAttribute = Mocks.CollectionBehaviorAttribute(disableTestParallelization: true);254 var assembly = Mocks.AssemblyInfo(attributes: new[] { behaviorAttribute });255 var discoverer = TestableXunitTestFrameworkDiscoverer.Create(assembly);256 Assert.Matches(@"xUnit.net v3 \d+\.\d+\.\d+(-pre\.\d+(-dev)?(\+[0-9a-f]+)?)? \[collection-per-class, non-parallel\]", discoverer.TestFrameworkDisplayName);257 }258 }259 class ClassWithSingleTest260 {261 [Fact]262 public static void TestMethod() { }263 }264 class CustomTestCollectionFactory : IXunitTestCollectionFactory265 {266 public CustomTestCollectionFactory(_ITestAssembly testAssembly)267 { }268 public string DisplayName => "my-custom-test-collection-factory";269 public _ITestCollection Get(_ITypeInfo testClass) => throw new NotImplementedException();270 }271 class TestableXunitTestFrameworkDiscoverer : XunitTestFrameworkDiscoverer272 {273 public List<_ITestCaseMetadata> FindTestsForType_TestCases = new();274 TestableXunitTestFrameworkDiscoverer(275 _IAssemblyInfo assemblyInfo,276 IXunitTestCollectionFactory? collectionFactory)277 : base(assemblyInfo, configFileName: null, collectionFactory)278 {279 TestAssembly = Mocks.TestAssembly(assemblyInfo.AssemblyPath, uniqueID: "asm-id");280 }281 public new _IAssemblyInfo AssemblyInfo => base.AssemblyInfo;282 public override _ITestAssembly TestAssembly { get; }283 public new ValueTask<_ITestClass> CreateTestClass(_ITypeInfo @class) =>284 base.CreateTestClass(@class);285 public ValueTask<bool> FindTestsForType(286 _ITestClass testClass,287 _ITestFrameworkDiscoveryOptions? discoveryOptions = null) =>288 base.FindTestsForType(289 testClass,290 discoveryOptions ?? _TestFrameworkOptions.ForDiscovery(preEnumerateTheories: true),291 testCase =>292 {293 FindTestsForType_TestCases.Add(testCase);294 return new(true);295 }296 );297 protected sealed override bool IsValidTestClass(_ITypeInfo type) =>298 base.IsValidTestClass(type);299 public static TestableXunitTestFrameworkDiscoverer Create(300 _IAssemblyInfo? assembly = null,301 IXunitTestCollectionFactory? collectionFactory = null) =>302 new(assembly ?? Mocks.AssemblyInfo(), collectionFactory);303 }304}...

Full Screen

Full Screen

ExtensibilityPointFactoryTests.cs

Source:ExtensibilityPointFactoryTests.cs Github

copy

Full Screen

...12 public void NoAttribute()13 {14 var spy = SpyMessageSink.Capture();15 TestContext.Current!.DiagnosticMessageSink = spy;16 var assembly = Mocks.AssemblyInfo();17 var framework = ExtensibilityPointFactory.GetTestFramework(assembly);18 Assert.IsType<XunitTestFramework>(framework);19 Assert.Empty(spy.Messages);20 }21 [Fact]22 public void Attribute_NoDiscoverer()23 {24 var spy = SpyMessageSink.Capture();25 TestContext.Current!.DiagnosticMessageSink = spy;26 var attribute = Mocks.TestFrameworkAttribute<AttributeWithoutDiscoverer>();27 var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute });28 var framework = ExtensibilityPointFactory.GetTestFramework(assembly);29 Assert.IsType<XunitTestFramework>(framework);30 AssertSingleDiagnosticMessage(spy, "Assembly-level test framework attribute was not decorated with [TestFrameworkDiscoverer]");31 }32 class AttributeWithoutDiscoverer : Attribute, ITestFrameworkAttribute { }33 [Fact]34 public void Attribute_ThrowingDiscovererCtor()35 {36 CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;37 var spy = SpyMessageSink.Capture();38 TestContext.Current!.DiagnosticMessageSink = spy;39 var attribute = Mocks.TestFrameworkAttribute<AttributeWithThrowingDiscovererCtor>();40 var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute });41 var factory = ExtensibilityPointFactory.GetTestFramework(assembly);42 Assert.IsType<XunitTestFramework>(factory);43 AssertSingleDiagnosticMessage(spy, "Exception thrown during test framework discoverer construction: System.DivideByZeroException: Attempted to divide by zero.");44 }45 [TestFrameworkDiscoverer(typeof(ThrowingDiscovererCtor))]46 class AttributeWithThrowingDiscovererCtor : Attribute, ITestFrameworkAttribute47 { }48 public class ThrowingDiscovererCtor : ITestFrameworkTypeDiscoverer49 {50 public ThrowingDiscovererCtor() =>51 throw new DivideByZeroException();52 public Type GetTestFrameworkType(_IAttributeInfo attribute) =>53 throw new NotImplementedException();54 }55 [Fact]56 public void Attribute_ThrowingDiscovererMethod()57 {58 CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;59 var spy = SpyMessageSink.Capture();60 TestContext.Current!.DiagnosticMessageSink = spy;61 var attribute = Mocks.TestFrameworkAttribute<AttributeWithThrowingDiscovererMethod>();62 var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute });63 var framework = ExtensibilityPointFactory.GetTestFramework(assembly);64 Assert.IsType<XunitTestFramework>(framework);65 AssertSingleDiagnosticMessage(spy, "Exception thrown during test framework discoverer construction: System.DivideByZeroException: Attempted to divide by zero.");66 }67 [TestFrameworkDiscoverer(typeof(ThrowingDiscoverer))]68 class AttributeWithThrowingDiscovererMethod : Attribute, ITestFrameworkAttribute69 { }70 public class ThrowingDiscoverer : ITestFrameworkTypeDiscoverer71 {72 public Type GetTestFrameworkType(_IAttributeInfo attribute) =>73 throw new DivideByZeroException();74 }75 [Fact]76 public void Attribute_ThrowingTestFrameworkCtor()77 {78 CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;79 var spy = SpyMessageSink.Capture();80 TestContext.Current!.DiagnosticMessageSink = spy;81 var attribute = Mocks.TestFrameworkAttribute<AttributeWithThrowingTestFrameworkCtor>();82 var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute });83 var framework = ExtensibilityPointFactory.GetTestFramework(assembly);84 Assert.IsType<XunitTestFramework>(framework);85 AssertSingleDiagnosticMessage(spy, "Exception thrown during test framework construction; falling back to default test framework: System.DivideByZeroException: Attempted to divide by zero.");86 }87 [TestFrameworkDiscoverer(typeof(DiscovererForThrowingTestFrameworkCtor))]88 class AttributeWithThrowingTestFrameworkCtor : Attribute, ITestFrameworkAttribute89 { }90 public class DiscovererForThrowingTestFrameworkCtor : ITestFrameworkTypeDiscoverer91 {92 public Type GetTestFrameworkType(_IAttributeInfo attribute) =>93 typeof(ThrowingTestFrameworkCtor);94 }95 public class ThrowingTestFrameworkCtor : _ITestFramework96 {97 public ThrowingTestFrameworkCtor() =>98 throw new DivideByZeroException();99 public _ISourceInformationProvider SourceInformationProvider { get; set; }100 public _ITestFrameworkDiscoverer GetDiscoverer(_IAssemblyInfo assembly) =>101 throw new NotImplementedException();102 public _ITestFrameworkExecutor GetExecutor(_IReflectionAssemblyInfo assembly) =>103 throw new NotImplementedException();104 }105 [Fact]106 public void Attribute_WithDiscoverer_NoMessageSink()107 {108 var spy = SpyMessageSink.Capture();109 TestContext.Current!.DiagnosticMessageSink = spy;110 var attribute = Mocks.TestFrameworkAttribute<AttributeWithDiscoverer>();111 var assembly = Mocks.AssemblyInfo(attributes: new[] { attribute });112 ExtensibilityPointFactory.GetTestFramework(assembly);113 Assert.Empty(spy.Messages);114 }115 [TestFrameworkDiscoverer(typeof(MyDiscoverer))]116 public class AttributeWithDiscoverer : Attribute, ITestFrameworkAttribute117 { }118 public class MyDiscoverer : ITestFrameworkTypeDiscoverer119 {120 public Type GetTestFrameworkType(_IAttributeInfo attribute) =>121 typeof(MyTestFramework);122 }123 public class MyTestFramework : _ITestFramework124 {125 public _ISourceInformationProvider? SourceInformationProvider { get; set; }126 public _ITestFrameworkDiscoverer GetDiscoverer(_IAssemblyInfo assembly) =>127 throw new NotImplementedException();128 public _ITestFrameworkExecutor GetExecutor(_IReflectionAssemblyInfo assembly) =>129 throw new NotImplementedException();130 }131 }132 public class GetXunitTestCollectionFactory : ExtensibilityPointFactoryTests133 {134 [Fact]135 public void DefaultTestCollectionFactoryIsCollectionPerClass()136 {137 var assembly = Mocks.TestAssembly();138 var result = ExtensibilityPointFactory.GetXunitTestCollectionFactory((_IAttributeInfo?)null, assembly);139 Assert.IsType<CollectionPerClassTestCollectionFactory>(result);140 }141 [Theory(DisableDiscoveryEnumeration = true)]142 [InlineData(CollectionBehavior.CollectionPerAssembly, typeof(CollectionPerAssemblyTestCollectionFactory))]143 [InlineData(CollectionBehavior.CollectionPerClass, typeof(CollectionPerClassTestCollectionFactory))]144 public void UserCanChooseFromBuiltInCollectionFactories_NonParallel(CollectionBehavior behavior, Type expectedType)145 {146 var attr = Mocks.CollectionBehaviorAttribute(behavior);147 var assembly = Mocks.TestAssembly();148 var result = ExtensibilityPointFactory.GetXunitTestCollectionFactory(attr, assembly);149 Assert.IsType(expectedType, result);150 }151 [Fact]152 public void UserCanChooseCustomCollectionFactoryWithType()153 {154 var attr = Mocks.CollectionBehaviorAttribute<MyTestCollectionFactory>();155 var assembly = Mocks.TestAssembly();156 var result = ExtensibilityPointFactory.GetXunitTestCollectionFactory(attr, assembly);157 var myFactory = Assert.IsType<MyTestCollectionFactory>(result);158 Assert.Same(assembly, myFactory.Assembly);159 }160 [Fact]161 public void UserCanChooseCustomCollectionFactoryWithTypeAndAssemblyName()162 {163 var factoryType = typeof(MyTestCollectionFactory);164 var attr = Mocks.CollectionBehaviorAttribute(factoryType.FullName!, factoryType.Assembly.FullName!);165 var assembly = Mocks.TestAssembly();166 var result = ExtensibilityPointFactory.GetXunitTestCollectionFactory(attr, assembly);167 var myFactory = Assert.IsType<MyTestCollectionFactory>(result);168 Assert.Same(assembly, myFactory.Assembly);169 }170 class MyTestCollectionFactory : IXunitTestCollectionFactory171 {172 public MyTestCollectionFactory(_ITestAssembly assembly)173 {174 Assembly = assembly;175 }176 public readonly _ITestAssembly Assembly;177 public string DisplayName =>178 "My Factory";179 public _ITestCollection Get(_ITypeInfo testClass) =>180 throw new NotImplementedException();181 }182 [Theory]183 [InlineData(184 "ExtensibilityPointFactoryTests+GetXunitTestCollectionFactory+TestCollectionFactory_NoCompatibleConstructor",185 "Could not find constructor for 'ExtensibilityPointFactoryTests+GetXunitTestCollectionFactory+TestCollectionFactory_NoCompatibleConstructor' with arguments type(s): Castle.Proxies.InterfaceProxy")]186 [InlineData(187 "ExtensibilityPointFactoryTests+GetXunitTestCollectionFactory+TestCollectionFactory_DoesNotImplementInterface",188 "Test collection factory type 'xunit.v3.core.tests, ExtensibilityPointFactoryTests+GetXunitTestCollectionFactory+TestCollectionFactory_DoesNotImplementInterface' does not implement IXunitTestCollectionFactory")]189 [InlineData(190 "ThisIsNotARealType",191 "Unable to create test collection factory type 'xunit.v3.core.tests, ThisIsNotARealType'")]192 public void IncompatibleOrInvalidTypesGetDefaultBehavior(string factoryTypeName, string expectedMessage)193 {194 var spy = SpyMessageSink.Capture();195 TestContext.Current!.DiagnosticMessageSink = spy;196#if BUILD_X86197 expectedMessage = expectedMessage.Replace("xunit.v3.core.tests", "xunit.v3.core.tests.x86");198 var attr = Mocks.CollectionBehaviorAttribute(factoryTypeName, "xunit.v3.core.tests.x86");199#else200 var attr = Mocks.CollectionBehaviorAttribute(factoryTypeName, "xunit.v3.core.tests");201#endif202 var assembly = Mocks.TestAssembly();203 var result = ExtensibilityPointFactory.GetXunitTestCollectionFactory(attr, assembly);204 AssertSingleDiagnosticMessage(spy, expectedMessage);205 }206 class TestCollectionFactory_NoCompatibleConstructor : IXunitTestCollectionFactory207 {208 public string DisplayName =>209 throw new NotImplementedException();210 public _ITestCollection Get(_ITypeInfo _) =>211 throw new NotImplementedException();212 }213 class TestCollectionFactory_DoesNotImplementInterface214 {215 public TestCollectionFactory_DoesNotImplementInterface(_IAssemblyInfo _)216 { }217 }218 }219 void AssertSingleDiagnosticMessage(SpyMessageSink spy, string expectedMessage)220 {221 var message = Assert.Single(spy.Messages);222 var diagnosticMessage = Assert.IsAssignableFrom<_DiagnosticMessage>(message);223 Assert.StartsWith(expectedMessage, diagnosticMessage.Message);224 }225}...

Full Screen

Full Screen

ProjectParserTest.cs

Source:ProjectParserTest.cs Github

copy

Full Screen

...141 _config.Stub(x => x.ProjectsToIgnore).Return(new string[] {});142 var document = _parser.Parse(getCSharpProject(), null);143 document.Files[0].File.ShouldEqual(Path.GetFullPath(string.Format("TestResources{0}VS2008{0}Class1.cs", Path.DirectorySeparatorChar).Replace("\\", Path.DirectorySeparatorChar.ToString())));144 document.Files[0].Type.ShouldEqual(FileType.Compile);145 document.Files[1].File.ShouldEqual(Path.GetFullPath(string.Format("TestResources{0}VS2008{0}Properties{0}AssemblyInfo.cs", Path.DirectorySeparatorChar).Replace("\\", Path.DirectorySeparatorChar.ToString())));146 document.Files[2].File.ShouldEqual(Path.GetFullPath(string.Format("TestResources{0}VS2008{0}UI{0}VersionedConfigOption.resx", Path.DirectorySeparatorChar).Replace("\\", Path.DirectorySeparatorChar.ToString())));147 document.Files[2].Type.ShouldEqual(FileType.Resource);148 document.Files[3].File.ShouldEqual(Path.GetFullPath(string.Format("TestResources{0}VS2008{0}Resources{0}MM_shaded.bmp", Path.DirectorySeparatorChar).Replace("\\", Path.DirectorySeparatorChar.ToString())));149 document.Files[3].Type.ShouldEqual(FileType.None);150 }151 [Test]152 public void Should_not_parse_ignored_projects()153 {154 _config.Stub(x => x.ProjectsToIgnore).Return(new[] { "*IgnoredProject.csproj" });155 Assert.That(_parser.Parse("An/IgnoredProject.csproj", null), Is.Null);156 }157 private string getCSharpProject()158 {159 return string.Format("TestResources{0}VS2008{0}CSharpNUnitTestProject.csproj", Path.DirectorySeparatorChar);...

Full Screen

Full Screen

Mocks.TestCases.cs

Source:Mocks.TestCases.cs Github

copy

Full Screen

...29 _IReflectionAttributeInfo[]? assemblyAttributes = null,30 string? configFileName = null,31 Version? version = null,32 string? uniqueID = null) =>33 TestAssembly(AssemblyInfo(types, assemblyAttributes, assemblyFileName), configFileName, version, uniqueID);34 public static _ITestAssembly TestAssembly(35 Assembly assembly,36 string? configFileName = null,37 Version? version = null,38 string? uniqueID = null) =>39 TestAssembly(Reflector.Wrap(assembly), configFileName, version, uniqueID);40 public static _ITestAssembly TestAssembly(41 _IAssemblyInfo? assemblyInfo = null,42 string? configFileName = null,43 Version? version = null,44 string? uniqueID = null)45 {46 assemblyInfo ??= AssemblyInfo();47 uniqueID ??= "assembly-id";48 version ??= new Version(2112, 42, 2600);49 var result = Substitute.For<_ITestAssembly, InterfaceProxy<_ITestAssembly>>();50 result.Assembly.Returns(assemblyInfo);51 result.ConfigFileName.Returns(configFileName);52 result.UniqueID.Returns(uniqueID);53 result.Version.Returns(version);54 return result;55 }56 public static _ITestCase TestCase<TClassUnderTest>(57 string methodName,58 string? displayName = null,59 string? skipReason = null,60 IReadOnlyDictionary<string, IReadOnlyList<string>>? traits = null,...

Full Screen

Full Screen

TestFrameworkDiscovererTests.cs

Source:TestFrameworkDiscovererTests.cs Github

copy

Full Screen

...55 public static async ValueTask RequestsPublicTypesFromAssembly()56 {57 var framework = TestableTestFrameworkDiscoverer.Create();58 await framework.Find();59 framework.AssemblyInfo.Received(1).GetTypes(includePrivateTypes: false);60 }61 [Fact]62 public static async ValueTask IncludesNonAbstractTypes()63 {64 var objectTypeInfo = Reflector.Wrap(typeof(object));65 var intTypeInfo = Reflector.Wrap(typeof(int));66 var discoverer = TestableTestFrameworkDiscoverer.Create(objectTypeInfo, intTypeInfo);67 await discoverer.Find();68 Assert.Collection(69 discoverer.FindTestsForType_TestClasses.Select(c => c.Class.Name).OrderBy(x => x),70 typeName => Assert.Equal(typeof(int).FullName, typeName), // System.Int3271 typeName => Assert.Equal(typeof(object).FullName, typeName) // System.Object72 );73 }74 [Fact]75 public static async ValueTask ExcludesAbstractTypes()76 {77 var abstractClassTypeInfo = Reflector.Wrap(typeof(AbstractClass));78 var discoverer = TestableTestFrameworkDiscoverer.Create(abstractClassTypeInfo);79 await discoverer.Find();80 Assert.Empty(discoverer.FindTestsForType_TestClasses);81 }82 }83 public class ByTypes84 {85 [Fact]86 public static async ValueTask IncludesNonAbstractTypes()87 {88 var discoverer = TestableTestFrameworkDiscoverer.Create();89 await discoverer.Find(types: new[] { typeof(object) });90 var testClass = Assert.Single(discoverer.FindTestsForType_TestClasses);91 Assert.Equal(typeof(object).FullName, testClass.Class.Name);92 }93 [Fact]94 public static async ValueTask ExcludesAbstractTypes()95 {96 var discoverer = TestableTestFrameworkDiscoverer.Create();97 await discoverer.Find(types: new[] { typeof(AbstractClass) });98 Assert.Empty(discoverer.FindTestsForType_TestClasses);99 }100 }101 public class WithCulture102 {103 readonly _ITypeInfo mockType = Mocks.TypeInfo("MockType");104 [Fact]105 public async ValueTask DefaultCultureIsCurrentCulture()106 {107 CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-US");108 var discoverer = TestableTestFrameworkDiscoverer.Create(mockType);109 var discoveryOptions = _TestFrameworkOptions.ForDiscovery(culture: null);110 await discoverer.Find(discoveryOptions);111 Assert.NotNull(discoverer.FindTestsForType_CurrentCulture);112 Assert.Equal("en-US", discoverer.FindTestsForType_CurrentCulture.Name);113 }114 [Fact]115 public async ValueTask EmptyStringIsInvariantCulture()116 {117 CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-US");118 var discoverer = TestableTestFrameworkDiscoverer.Create(mockType);119 var discoveryOptions = _TestFrameworkOptions.ForDiscovery(culture: string.Empty);120 await discoverer.Find(discoveryOptions);121 Assert.NotNull(discoverer.FindTestsForType_CurrentCulture);122 Assert.Equal(string.Empty, discoverer.FindTestsForType_CurrentCulture.Name);123 }124 [Fact]125 public async ValueTask CustomCultureViaDiscoveryOptions()126 {127 CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-US");128 var discoverer = TestableTestFrameworkDiscoverer.Create(mockType);129 var discoveryOptions = _TestFrameworkOptions.ForDiscovery(culture: "en-GB");130 await discoverer.Find(discoveryOptions);131 Assert.NotNull(discoverer.FindTestsForType_CurrentCulture);132 Assert.Equal("en-GB", discoverer.FindTestsForType_CurrentCulture.Name);133 }134 }135 abstract class AbstractClass136 {137 [Fact]138 public static void ATestNotToBeRun() { }139 }140 }141 class TestableTestFrameworkDiscoverer : TestFrameworkDiscoverer<_ITestCase>142 {143 public TestContext? FindTestsForType_Context;144 public CultureInfo? FindTestsForType_CurrentCulture;145 public Exception? FindTestsForType_Exception = null;146 public readonly List<_ITestClass> FindTestsForType_TestClasses = new();147 TestableTestFrameworkDiscoverer(_IAssemblyInfo assemblyInfo) :148 base(assemblyInfo)149 {150 TestAssembly = Mocks.TestAssembly(assemblyInfo.AssemblyPath, uniqueID: "asm-id");151 }152 public new _IAssemblyInfo AssemblyInfo => base.AssemblyInfo;153 public override _ITestAssembly TestAssembly { get; }154 public override string TestFrameworkDisplayName => "testable-test-framework";155 protected override ValueTask<_ITestClass> CreateTestClass(_ITypeInfo @class) =>156 new(Mocks.TestClass(@class));157 public ValueTask Find(158 _ITestFrameworkDiscoveryOptions? discoveryOptions = null,159 Type[]? types = null) =>160 Find(161 testCase => new(true),162 discoveryOptions ?? _TestFrameworkOptions.ForDiscovery(),163 types164 );165 protected override ValueTask<bool> FindTestsForType(166 _ITestClass testClass,167 _ITestFrameworkDiscoveryOptions discoveryOptions,168 Func<_ITestCase, ValueTask<bool>> discoveryCallback)169 {170 FindTestsForType_Context = TestContext.Current;171 FindTestsForType_CurrentCulture = CultureInfo.CurrentCulture;172 FindTestsForType_TestClasses.Add(testClass);173 if (FindTestsForType_Exception != null)174 throw FindTestsForType_Exception;175 return new(true);176 }177 public static TestableTestFrameworkDiscoverer Create(params _ITypeInfo[] types) =>178 new(Mocks.AssemblyInfo(types));179 }180}...

Full Screen

Full Screen

Mocks.Reflection.cs

Source:Mocks.Reflection.cs Github

copy

Full Screen

...10{11 // This file contains mocks of reflection abstractions.12 public static partial class Mocks13 {14 public static _IAssemblyInfo AssemblyInfo(15 _ITypeInfo[]? types = null,16 _IReflectionAttributeInfo[]? attributes = null,17 string? assemblyFileName = null)18 {19 attributes ??= EmptyAttributeInfos;20 assemblyFileName ??= $"assembly-{Guid.NewGuid():n}.dll";21 var result = Substitute.For<_IAssemblyInfo, InterfaceProxy<_IAssemblyInfo>>();22 result.AssemblyPath.Returns(assemblyFileName);23 result.Name.Returns(Path.GetFileNameWithoutExtension(assemblyFileName));24 result.GetCustomAttributes("").ReturnsForAnyArgs(callInfo => LookupAttribute(callInfo.Arg<string>(), attributes));25 result.GetType("").ReturnsForAnyArgs(types?.FirstOrDefault());26 result.GetTypes(true).ReturnsForAnyArgs(types ?? new _ITypeInfo[0]);27 return result;28 }29 public static _IReflectionAssemblyInfo AssemblyInfo(Assembly assembly) =>30 Reflector.Wrap(assembly);31 static IReadOnlyDictionary<string, IReadOnlyList<string>> GetTraits(_IMethodInfo method)32 {33 var result = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);34 foreach (var traitAttribute in method.GetCustomAttributes(typeof(TraitAttribute)))35 {36 var ctorArgs = traitAttribute.GetConstructorArguments().ToList();37 result.Add((string)ctorArgs[0]!, (string)ctorArgs[1]!);38 }39 return result.ToReadOnly();40 }41 public static _IReflectionMethodInfo MethodInfo<TClass>(string methodName) =>42 Guard.ArgumentNotNull(43 $"Could not find method '{methodName}' on '{typeof(TClass).FullName}'",44 Reflector.Wrap(typeof(TClass).GetMethod(methodName)),45 nameof(methodName)46 );47 public static _IMethodInfo MethodInfo(48 string? methodName = null,49 _IReflectionAttributeInfo[]? attributes = null,50 _IParameterInfo[]? parameters = null,51 _ITypeInfo? type = null,52 _ITypeInfo? returnType = null,53 _ITypeInfo[]? genericArguments = null,54 bool isAbstract = false,55 bool isGenericMethodDefinition = false,56 bool isPublic = true,57 bool isStatic = false)58 {59 methodName ??= $"method_{Guid.NewGuid():n}";60 attributes ??= EmptyAttributeInfos;61 parameters ??= EmptyParameterInfos;62 genericArguments ??= EmptyTypeInfos;63 var result = Substitute.For<_IMethodInfo, InterfaceProxy<_IMethodInfo>>();64 result.IsAbstract.Returns(isAbstract);65 result.IsGenericMethodDefinition.Returns(isGenericMethodDefinition);66 result.IsPublic.Returns(isPublic);67 result.IsStatic.Returns(isStatic);68 result.Name.Returns(methodName);69 result.ReturnType.Returns(returnType);70 result.Type.Returns(type);71 result.GetCustomAttributes("").ReturnsForAnyArgs(callInfo => LookupAttribute(callInfo.Arg<string>(), attributes));72 result.GetGenericArguments().Returns(genericArguments);73 result.GetParameters().Returns(parameters);74 // Difficult to simulate MakeGenericMethod here, so better to throw then just return null75 // and if any tests need this, then can override the substitution.76 result.MakeGenericMethod().WhenForAnyArgs(_ => throw new NotImplementedException());77 return result;78 }79 public static _IParameterInfo ParameterInfo(80 string name,81 _ITypeInfo? parameterType = null)82 {83 parameterType ??= TypeObject;84 var result = Substitute.For<_IParameterInfo, InterfaceProxy<_IParameterInfo>>();85 result.Name.Returns(name);86 result.ParameterType.Returns(parameterType);87 return result;88 }89 public static _IReflectionTypeInfo TypeInfo<TClass>() =>90 Reflector.Wrap(typeof(TClass));91 public static _ITypeInfo TypeInfo(92 string? name = null,93 _IMethodInfo[]? methods = null,94 _IReflectionAttributeInfo[]? attributes = null,95 _ITypeInfo? baseType = null,96 _ITypeInfo[]? interfaces = null,97 bool isAbstract = false,98 bool isGenericParameter = false,99 bool isGenericType = false,100 bool isValueType = false,101 _ITypeInfo[]? genericArguments = null,102 string? assemblyFileName = null)103 {104 baseType ??= TypeObject;105 name ??= $"type_{Guid.NewGuid():n}";106 methods ??= EmptyMethodInfos;107 interfaces ??= EmptyTypeInfos;108 genericArguments ??= EmptyTypeInfos;109 var assemblyInfo = AssemblyInfo(assemblyFileName: assemblyFileName);110 var result = Substitute.For<_ITypeInfo, InterfaceProxy<_ITypeInfo>>();111 result.Assembly.Returns(assemblyInfo);112 result.BaseType.Returns(baseType);113 result.IsAbstract.Returns(isAbstract);114 result.IsGenericParameter.Returns(isGenericParameter);115 result.IsGenericType.Returns(isGenericType);116 result.IsValueType.Returns(isValueType);117 result.Name.Returns(name);118 result.GetCustomAttributes("").ReturnsForAnyArgs(callInfo => LookupAttribute(callInfo.Arg<string>(), attributes));119 result.GetGenericArguments().Returns(genericArguments);120 result.GetMethod("", false).ReturnsForAnyArgs(callInfo => methods.FirstOrDefault(m => m.Name == callInfo.Arg<string>()));121 result.GetMethods(false).ReturnsForAnyArgs(methods);122 return result;123 }...

Full Screen

Full Screen

AssemblyInfo

Using AI Code Generation

copy

Full Screen

1using Xunit.v3.Mocks;2using Xunit.v3.Mocks;3using Xunit.v3.Mocks;4using Xunit.v3.Mocks;5using Xunit.v3.Mocks;6using Xunit.v3.Mocks;7using Xunit.v3.Mocks;8using Xunit.v3.Mocks;9using Xunit.v3.Mocks;10using Xunit.v3.Mocks;11using Xunit.v3.Mocks;12using Xunit.v3.Mocks;13using Xunit.v3.Mocks;14using Xunit.v3.Mocks;15using Xunit.v3.Mocks;16using Xunit.v3.Mocks;17using Xunit.v3.Mocks;

Full Screen

Full Screen

AssemblyInfo

Using AI Code Generation

copy

Full Screen

1using Xunit;2using Xunit.v3;3{4 public void Test1()5 {6 var mock = Xunit.v3.Mocks.AssemblyInfo("MyAssembly");7 var assembly = mock.Object;8 var result = assembly.Name;9 Assert.Equal("MyAssembly", result);10 }11}12using Xunit;13using Xunit.v3;14{15 public void Test1()16 {17 var mock = Xunit.v3.Mocks.AssemblyInfo("MyAssembly", "MyAssembly.dll");18 var assembly = mock.Object;19 var result = assembly.Name;20 Assert.Equal("MyAssembly", result);21 }22}23using Xunit;24using Xunit.v3;25{26 public void Test1()27 {28 var mock = Xunit.v3.Mocks.AssemblyInfo("MyAssembly", "MyAssembly.dll", "MyAssembly.xml");29 var assembly = mock.Object;30 var result = assembly.Name;31 Assert.Equal("MyAssembly", result);32 }33}34using Xunit;35using Xunit.v3;36{37 public void Test1()38 {39 var mock = Xunit.v3.Mocks.AssemblyInfo("MyAssembly", "MyAssembly.dll", "MyAssembly.xml", "MyAssembly.pdb");40 var assembly = mock.Object;41 var result = assembly.Name;42 Assert.Equal("MyAssembly", result);43 }44}45using Xunit;46using Xunit.v3;47{48 public void Test1()49 {50 var mock = Xunit.v3.Mocks.AssemblyInfo("MyAssembly", "MyAssembly.dll", "MyAssembly.xml", "MyAssembly.pdb", "MyAssembly.config");51 var assembly = mock.Object;52 var result = assembly.Name;53 Assert.Equal("MyAssembly", result);54 }55}56using Xunit;

Full Screen

Full Screen

AssemblyInfo

Using AI Code Generation

copy

Full Screen

1{2 {3 public static AssemblyInfo AssemblyInfo(string name, string version = null, string culture = null, string publicKeyToken = null)4 {5 return new AssemblyInfo(name, version, culture, publicKeyToken);6 }7 }8}9{10 {11 public AssemblyInfo(string name, string version, string culture, string publicKeyToken)12 {13 Name = name;14 Version = version;15 Culture = culture;16 PublicKeyToken = publicKeyToken;17 }18 public string Name { get; }19 public string Version { get; }20 public string Culture { get; }21 public string PublicKeyToken { get; }22 }23}24{25 {26 public static AssemblyInfo AssemblyInfo(string name, string version = null, string culture = null, string publicKeyToken = null)27 {28 return new AssemblyInfo(name, version, culture, publicKeyToken);29 }30 }31}32{33 {34 public AssemblyInfo(string name, string version, string culture, string publicKeyToken)35 {36 Name = name;37 Version = version;38 Culture = culture;39 PublicKeyToken = publicKeyToken;40 }41 public string Name { get; }42 public string Version { get; }43 public string Culture { get; }44 public string PublicKeyToken { get; }45 }46}47{48 {49 public static AssemblyInfo AssemblyInfo(string name, string version = null, string culture = null, string publicKeyToken = null)50 {51 return new AssemblyInfo(name, version, culture, publicKeyToken);52 }53 }54}55{56 {57 public AssemblyInfo(string name, string version, string culture, string publicKeyToken)58 {59 Name = name;60 Version = version;61 Culture = culture;62 PublicKeyToken = publicKeyToken;63 }64 public string Name { get; }65 public string Version { get; }66 public string Culture { get; }67 public string PublicKeyToken { get; }68 }69}

Full Screen

Full Screen

AssemblyInfo

Using AI Code Generation

copy

Full Screen

1using Xunit.v3.Mocks;2using Xunit.v3;3{4 public void TestMethod()5 {6 var assemblyInfo = AssemblyInfo.Create("MyAssembly");7 var typeInfo = assemblyInfo.Type("MyType");8 var methodInfo = typeInfo.Method("MyMethod");9 var testCase = methodInfo.TestCase();10 var testClass = new TestClass();11 var testMethod = new TestMethod(testCase, testClass);12 }13}14using Xunit.v3.Mocks;15using Xunit.v3;16{17 public void TestMethod()18 {19 var assemblyInfo = AssemblyInfo.Create("MyAssembly");20 var typeInfo = assemblyInfo.Type("MyType");21 var methodInfo = typeInfo.Method("MyMethod");22 var testCase = methodInfo.TestCase();23 }24}25using Xunit.v3.Mocks;26using Xunit.v3;27{28 public void TestMethod()29 {30 var assemblyInfo = AssemblyInfo.Create("MyAssembly");31 var typeInfo = assemblyInfo.Type("MyType");32 }33}34using Xunit.v3.Mocks;35using Xunit.v3;36{37 public void TestMethod()38 {39 var assemblyInfo = AssemblyInfo.Create("MyAssembly");40 var typeInfo = assemblyInfo.Type("MyType");41 var methodInfo = typeInfo.Method("MyMethod");42 }43}

Full Screen

Full Screen

AssemblyInfo

Using AI Code Generation

copy

Full Screen

1using Xunit;2{3 {4 public void Test1()5 {6 }7 }8}9using Xunit;10{11 {12 public void Test1()13 {14 }15 }16}17using Xunit;18{19 {20 public void Test1()21 {22 }23 }24}25using Xunit;26{27 {28 public void Test1()29 {30 }31 }32}33using Xunit;34{35 {36 public void Test1()37 {38 }39 }40}41using Xunit;42{43 {44 public void Test1()45 {46 }47 }48}49using Xunit;50{51 {52 public void Test1()53 {54 }55 }56}57using Xunit;58{59 {60 public void Test1()61 {62 }63 }64}65using Xunit;66{

Full Screen

Full Screen

AssemblyInfo

Using AI Code Generation

copy

Full Screen

1using Xunit;2using Xunit.v3;3{4 {5 public static void AssemblyInfo(string name)6 {7 }8 }9}10using Xunit;11using Xunit.v3;12{13 {14 public static void AssemblyInfo(string name, string version)15 {16 }17 }18}19using Xunit;20using Xunit.v3;21{22 {23 public static void AssemblyInfo(string name, string version)24 {25 }26 }27}28using Xunit;29using Xunit.v3;30[assembly: Mocks.AssemblyInfo("TestAssembly", "

Full Screen

Full Screen

AssemblyInfo

Using AI Code Generation

copy

Full Screen

1using Xunit;2using Xunit.v3;3[assembly: Xunit.v3.Mocks.AssemblyInfo("assembly-level attribute")]4using Xunit;5using Xunit.v3;6[assembly: Xunit.v3.Mocks.AssemblyInfo("assembly-level attribute")]7using Xunit;8using Xunit.v3;9[assembly: Xunit.v3.Mocks.AssemblyInfo("assembly-level attribute")]10using Xunit;11using Xunit.v3;12[assembly: Xunit.v3.Mocks.AssemblyInfo("assembly-level attribute")]13using Xunit;14using Xunit.v3;15[assembly: Xunit.v3.Mocks.AssemblyInfo("assembly-level attribute")]16using Xunit;17using Xunit.v3;18[assembly: Xunit.v3.Mocks.AssemblyInfo("assembly-level attribute")]19using Xunit;20using Xunit.v3;21[assembly: Xunit.v3.Mocks.AssemblyInfo("assembly-level attribute")]22using Xunit;23using Xunit.v3;24[assembly: Xunit.v3.Mocks.AssemblyInfo("assembly-level attribute")]25using Xunit;26using Xunit.v3;27[assembly: Xunit.v3.Mocks.AssemblyInfo("assembly-level attribute")]28using Xunit;29using Xunit.v3;30[assembly: Xunit.v3.Mocks.AssemblyInfo("assembly-level attribute")]

Full Screen

Full Screen

AssemblyInfo

Using AI Code Generation

copy

Full Screen

1var assembly = Xunit.v3.Mocks.AssemblyInfo(typeof(2).Assembly);2var assembly = Xunit.v3.Mocks.AssemblyInfo(typeof(1).Assembly);3var assembly = Xunit.v3.Mocks.AssemblyInfo(typeof(3).Assembly);4var assembly = Xunit.v3.Mocks.AssemblyInfo(typeof(4).Assembly);5var assembly = Xunit.v3.Mocks.AssemblyInfo(typeof(5).Assembly);6var assembly = Xunit.v3.Mocks.AssemblyInfo(typeof(6).Assembly);7var assembly = Xunit.v3.Mocks.AssemblyInfo(typeof(7).Assembly);8var assembly = Xunit.v3.Mocks.AssemblyInfo(typeof(8).Assembly);

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful