Microsoft.UnitTests.Core.XUnit.AssemblyRunner.AfterTestAssemblyStartingAsync C# (CSharp) Method

AfterTestAssemblyStartingAsync() protected method

protected AfterTestAssemblyStartingAsync ( ) : Task
return Task
        protected override async Task AfterTestAssemblyStartingAsync() {
            await base.AfterTestAssemblyStartingAsync();

            _assemblyLoaders = AssemblyLoaderAttribute.GetAssemblyLoaders(TestAssembly.Assembly);

            var assembly = TestAssembly.Assembly;
            var importedAssemblyFixtureTypes = assembly.GetCustomAttributes(typeof (AssemblyFixtureImportAttribute))
                .SelectMany(ai => ai.GetConstructorArguments())
                .OfType<Type[]>()
                .SelectMany(a => a);

            var assemblyFixtureTypes = assembly.GetTypes(false)
                .Where(t => t.GetCustomAttributes(typeof(AssemblyFixtureAttribute).AssemblyQualifiedName).Any())
                .Select(t => t.ToRuntimeType())
                .Concat(importedAssemblyFixtureTypes)
                .ToList();

            var fixtures = new Dictionary<Type, object>();

            foreach (var type in assemblyFixtureTypes) {
                await Aggregator.RunAsync(() => AddAssemblyFixtureAsync(fixtures, type));
            }

            _assemblyFixtureMappings = new ReadOnlyDictionary<Type, object>(fixtures);
        }