0

So, I have a very weird bug that's ending my rationality.

My problem is simple. If I write a. HttpClient.PostAsync anywhere in my test, (no matter if it's directly or via a delegate), my test does not run and just ends with the message "Inconclusive: Test not run". No error, no nothing.

Why is this happening, and how can I fix it? It was working fine a few days ago...

    [Test]
    public async Task TestAadfdsfsdsxc()
    {     
        HttpClient Client = new HttpClient();
        Client.DefaultRequestHeaders.Add("X-API-Key", $"{apiKey}");
        Client.DefaultRequestHeaders.Add("accept", "text/plain");
        Client.BaseAddress = new Uri($"{url}/api/");

        var buffer = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload));
        var byteContent = new ByteArrayContent(buffer);
        byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
        var postResponse = await Client.PostAsync(Client.BaseAddress+$"{PayloadEndpoint}", byteContent);
    }

Get requests work fine. Also worth nothing that if the PostAsync is there, no other tests run either. They all end as Inconclusive, not run. Commenting out the line works.

Using "Microsoft Visual Studio Professional 2017 - Version 15.9.7" No compilation errors. Also using ReSharper 2018.3.3.

I will reiterate that everything worked fine till a few days ago.

rtgher
  • 149
  • 7
  • Are you running your tests though Test Explorer or ReSharpers Unit Tests? Did you tried run test though nunit-console? – Lemm Jul 31 '19 at 14:09
  • When I try to run through the Test Explorer it just automatically starts it in the ReSharper Unit Test window. did not try the console.. – rtgher Jul 31 '19 at 14:10
  • Do you use Nunit Test Adapter and did it's version same as version of NUnit in your project? – Lemm Jul 31 '19 at 14:17
  • 1
    You really need to look at this question, has a lot of answers due to this is very common ReSharper issue: https://stackoverflow.com/questions/18311108/test-method-is-inconclusive-test-wasnt-run-error – Lemm Jul 31 '19 at 14:21
  • Looked at it and ti did help. My problem was a mxi of having Specflow in my App.config and a missing nuget that still had a dependency in the app.configs – rtgher Jul 31 '19 at 15:05

0 Answers0