dreadfullydistinct
dreadfullydistinct
CC#
Created by Raso on 12/8/2024 in #help
Issue with xUnit and Integration Test
https://github.com/xunit/xunit/issues/980#issuecomment-248213473 xunit runs tests in a random order by design, to prevent exactly what you want - dependencies between tests
13 replies
CC#
Created by Raso on 12/8/2024 in #help
Issue with xUnit and Integration Test
or apparently you can do [assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]
13 replies
CC#
Created by Raso on 12/8/2024 in #help
Issue with xUnit and Integration Test
When I've done this before, we had a base test class which put everything in the same collection. That class implemented the IAsyncLifetime interface which reset the database and all that
13 replies
CC#
Created by Raso on 12/8/2024 in #help
Issue with xUnit and Integration Test
13 replies
CC#
Created by Raso on 12/8/2024 in #help
Issue with xUnit and Integration Test
With that suggested collection layout, xunit may still run the delete tests in parallel with the get which will be problematic
13 replies
CC#
Created by Raso on 12/8/2024 in #help
Issue with xUnit and Integration Test
I’m sure you can hack XUnit to get a deterministic test run order but don’t do that
13 replies
CC#
Created by Raso on 12/8/2024 in #help
Issue with xUnit and Integration Test
Or 2. If your system is multi tenant, have each test run under its own user id or organisation id or whatever, so that they don’t interfere with each other, even when running in parallel
13 replies
CC#
Created by Raso on 12/8/2024 in #help
Issue with xUnit and Integration Test
Either 1. Use collections to ensure the tests don’t run in parallel and have a common setup and reset method, using perhaps IAsyncLifetime on the base class
13 replies
CC#
Created by Raso on 12/8/2024 in #help
Issue with xUnit and Integration Test
There are a couple of approaches you can use
13 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
$close
20 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
Close
20 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
There’s a slash command
20 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
Idk
20 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
$solve
20 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
^ that too, when I’ve deployed stuff like Grafana I’ve had to specify a domain in the config, so I assume they might be doing something like this for their redirects
20 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
But I don’t know if that’s the ideal way to do it, I’ve not seen it being done elsewhere 😅
20 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
This is required to be set for all HTTP requests and iirc shouldnt be messed up by a reverse proxy
20 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
Ah ok, when I’ve done this before I just grabbed the Host header from the request (via HttpContext.Request.Host)
20 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
Or are you asking about how to get the domain?
20 replies
CC#
Created by Luca | LeCarbonator on 11/13/2024 in #help
✅ Is it possible to access a Controller's URI at runtime?
You can use reflection to get at the routing attribute, but that could be quite nasty
20 replies