예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="messageAggregator">The message aggregator to receive environmental warnings from.</param>
        public TestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                       ISourceInformationProvider sourceProvider,
                                       IMessageAggregator messageAggregator)
        {
            Guard.ArgumentNotNull("assemblyInfo", assemblyInfo);
            Guard.ArgumentNotNull("sourceProvider", sourceProvider);

            Aggregator      = messageAggregator ?? MessageAggregator.Instance;
            AssemblyInfo    = assemblyInfo;
            DisposalTracker = new DisposalTracker();
            SourceProvider  = sourceProvider;

            targetFramework = new Lazy <string>(() =>
            {
                string result = null;

                var attrib = AssemblyInfo.GetCustomAttributes(typeof(TargetFrameworkAttribute)).FirstOrDefault();
                if (attrib != null)
                {
                    result = attrib.GetConstructorArguments().Cast <string>().First();
                }

                return(result ?? "");
            });
        }
예제 #2
0
        /// <inheritdoc/>
        public ITestFrameworkDiscoverer GetDiscoverer(IAssemblyInfo assemblyInfo)
        {
            var discoverer = CreateDiscoverer(assemblyInfo);

            DisposalTracker.Add(discoverer);
            return(discoverer);
        }
예제 #3
0
        /// <inheritdoc/>
        public ITestFrameworkExecutor GetExecutor(AssemblyName assemblyName)
        {
            var executor = CreateExecutor(assemblyName);

            DisposalTracker.Add(executor);
            return(executor);
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestFramework"/> class.
        /// </summary>
        /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param>
        protected TestFramework(IMessageSink diagnosticMessageSink)
        {
            Guard.ArgumentNotNull("diagnosticMessageSink", diagnosticMessageSink);

            DiagnosticMessageSink = diagnosticMessageSink;
            DisposalTracker = new DisposalTracker();
            SourceInformationProvider = NullSourceInformationProvider.Instance;
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestFramework"/> class.
        /// </summary>
        /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param>
        protected TestFramework(IMessageSink diagnosticMessageSink)
        {
            Guard.ArgumentNotNull("diagnosticMessageSink", diagnosticMessageSink);

            DiagnosticMessageSink     = diagnosticMessageSink;
            DisposalTracker           = new DisposalTracker();
            SourceInformationProvider = NullSourceInformationProvider.Instance;
        }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestFrameworkExecutor{TTestCase}"/> class.
        /// </summary>
        /// <param name="assemblyName">Name of the test assembly.</param>
        /// <param name="sourceInformationProvider">The source line number information provider.</param>
        protected TestFrameworkExecutor(AssemblyName assemblyName, ISourceInformationProvider sourceInformationProvider)
        {
            DisposalTracker = new DisposalTracker();

            SourceInformationProvider = sourceInformationProvider;

            var assembly = Assembly.Load(assemblyName);

            AssemblyInfo = Reflector.Wrap(assembly);
        }
예제 #7
0
        /// <inheritdoc/>
        public async void Dispose()
        {
            // We want to immediately return before we call DisconnectAll, since we are in the list
            // of things that will be disconnected.
            await Task.Delay(1);

            ExtensibilityPointFactory.Dispose();
            DisposalTracker.Dispose();

            LongLivedMarshalByRefObject.DisconnectAll();
        }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="messageAggregator">The message aggregator to receive environmental warnings from.</param>
        public TestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                       ISourceInformationProvider sourceProvider,
                                       IMessageAggregator messageAggregator)
        {
            Guard.ArgumentNotNull("assemblyInfo", assemblyInfo);
            Guard.ArgumentNotNull("sourceProvider", sourceProvider);

            Aggregator      = messageAggregator ?? MessageAggregator.Instance;
            AssemblyInfo    = assemblyInfo;
            DisposalTracker = new DisposalTracker();
            SourceProvider  = sourceProvider;
        }
예제 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestFrameworkExecutor{TTestCase}"/> class.
        /// </summary>
        /// <param name="assemblyName">Name of the test assembly.</param>
        /// <param name="sourceInformationProvider">The source line number information provider.</param>
        protected TestFrameworkExecutor(AssemblyName assemblyName, ISourceInformationProvider sourceInformationProvider)
        {
            DisposalTracker           = new DisposalTracker();
            SourceInformationProvider = sourceInformationProvider;

#if !WIN8_STORE || WINDOWS_PHONE_APP || WINDOWS_PHONE
            var assembly = Assembly.Load(assemblyName);
#else
            var assembly = Assembly.Load(assemblyName.Name);
#endif
            AssemblyInfo = Reflector.Wrap(assembly);
        }
예제 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestFrameworkExecutor{TTestCase}"/> class.
        /// </summary>
        /// <param name="assemblyName">Name of the test assembly.</param>
        /// <param name="sourceInformationProvider">The source line number information provider.</param>
        /// <param name="diagnosticMessageSink">The message sink to report diagnostic messages to.</param>
        protected TestFrameworkExecutor(AssemblyName assemblyName,
                                        ISourceInformationProvider sourceInformationProvider,
                                        IMessageSink diagnosticMessageSink)
        {
            DisposalTracker           = new DisposalTracker();
            SourceInformationProvider = sourceInformationProvider;
            DiagnosticMessageSink     = diagnosticMessageSink;

            var assembly = Assembly.Load(assemblyName);

            AssemblyInfo = Reflector.Wrap(assembly);
        }
예제 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="messageAggregator">The message aggregator to receive environmental warnings from.</param>
        public TestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                       ISourceInformationProvider sourceProvider,
                                       IMessageAggregator messageAggregator)
        {
            Guard.ArgumentNotNull("assemblyInfo", assemblyInfo);
            Guard.ArgumentNotNull("sourceProvider", sourceProvider);

            Aggregator = messageAggregator ?? MessageAggregator.Instance;
            AssemblyInfo = assemblyInfo;
            DisposalTracker = new DisposalTracker();
            SourceProvider = sourceProvider;
        }
예제 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="messageAggregator">The message aggregator to receive environmental warnings from.</param>
        public TestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                       ISourceInformationProvider sourceProvider,
                                       IMessageAggregator messageAggregator)
        {
            Guard.ArgumentNotNull("assemblyInfo", assemblyInfo);
            Guard.ArgumentNotNull("sourceProvider", sourceProvider);

            Aggregator = messageAggregator ?? MessageAggregator.Instance;
            AssemblyInfo = assemblyInfo;
            DisposalTracker = new DisposalTracker();
            SourceProvider = sourceProvider;

            targetFramework = new Lazy<string>(() =>
            {
                string result = null;

                var attrib = AssemblyInfo.GetCustomAttributes(typeof(TargetFrameworkAttribute)).FirstOrDefault();
                if (attrib != null)
                    result = attrib.GetConstructorArguments().Cast<string>().First();

                return result ?? "";
            });
        }
예제 #13
0
 /// <inheritdoc/>
 public void Dispose()
 {
     DisposalTracker.Dispose();
 }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestFramework"/> class.
 /// </summary>
 public TestFramework()
 {
     DisposalTracker           = new DisposalTracker();
     SourceInformationProvider = NullSourceInformationProvider.Instance;
 }
예제 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XunitTestFramework"/> class.
 /// </summary>
 public TestFramework()
 {
     DisposalTracker = new DisposalTracker();
     SourceInformationProvider = NullSourceInformationProvider.Instance;
 }