public void WhenAssemblyIsNative()
        {
            var context           = new FakeDiscoveryContext(null);
            var messageLoggerStub = new MessageLoggerStub();
            var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "NativeTests.dll");

            Assert.That(File.Exists(path));
            TestAdapterUtils.CreateDiscoverer().DiscoverTests(
                new[] { path },
                context,
                messageLoggerStub,
                this);
            Assert.Multiple(() =>
            {
                Assert.That(testcaseWasSent, Is.False);
                Assert.That(messageLoggerStub.WarningMessages.Count(), Is.EqualTo(1));
                Assert.That(!messageLoggerStub.ErrorMessages.Any());
                string warningmsg = messageLoggerStub.WarningMessages.Select(o => o.Item2).FirstOrDefault();
                Assert.That(warningmsg, Is.Not.Null);
                if (!string.IsNullOrEmpty(warningmsg))
                {
                    Assert.That(warningmsg, Does.Contain("Assembly not supported"));
                }
            });
        }
 public void VerifyLoading(IDiscoveryContext context)
 {
     // Load the NUnit empty-assembly.dll once for this test
     TestAdapterUtils.CreateDiscoverer().DiscoverTests(
         new[] { EmptyAssemblyPath },
         context,
         new MessageLoggerStub(),
         this);
 }
        public void WhenAssemblyDontExist()
        {
            int noOfMessagesFound = 3; // Start + end, + info
            var context           = new FakeDiscoveryContext(null);
            var messageLoggerStub = new MessageLoggerStub();

            TestAdapterUtils.CreateDiscoverer().DiscoverTests(
                new[] { "FileThatDoesntExist.dll" },
                context,
                messageLoggerStub,
                this);
            Assert.Multiple(() =>
            {
                Assert.That(messageLoggerStub.Count, Is.EqualTo(noOfMessagesFound));
                Assert.That(messageLoggerStub.LatestTestMessageLevel, Is.EqualTo(TestMessageLevel.Informational));
                Assert.That(testcaseWasSent, Is.False);
                Assert.That(!messageLoggerStub.ErrorMessages.Any());
                Assert.That(!messageLoggerStub.WarningMessages.Any());
            });
        }