예제 #1
0
        void HandleTestAssemblyFinished(MessageHandlerArgs <ITestAssemblyFinished> args)
        {
            lock (clientLock)
            {
                assembliesInFlight--;

                if (assembliesInFlight == 0)
                {
                    // Drain the queue
                    client.WaitOne(CancellationToken.None);
                    client.Dispose();
                    client = null;
                }
            }
        }
예제 #2
0
        void HandleTestAssemblyStarting(MessageHandlerArgs <ITestAssemblyStarting> args)
        {
            lock (clientLock)
            {
                assembliesInFlight++;

                // Look for the TFM attrib to disambiguate
                var attrib           = args.Message.TestAssembly.Assembly.GetCustomAttributes("System.Runtime.Versioning.TargetFrameworkAttribute").FirstOrDefault();
                var assemblyFileName = Path.GetFileName(args.Message.TestAssembly.Assembly.AssemblyPath);
                if (attrib?.GetConstructorArguments().FirstOrDefault() is string arg)
                {
                    assemblyFileName = $"{assemblyFileName} ({arg})";
                }

                assemblyNames[args.Message.TestAssembly.Assembly.Name] = assemblyFileName;

                if (client == null)
                {
                    client = new VstsClient(Logger, baseUri, accessToken, buildId);
                }
            }
        }