-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
cc @davidfowl \ @JunTaoLuo |
@@ -89,6 +57,7 @@ protected virtual void AddAdditionalServices(IServiceCollection services) | |||
// points to the root folder of the test project. | |||
// To compensate, we need to calculate the correct project path and override the application | |||
// environment value so that components like the view engine work properly in the context of the test. | |||
var startupAssembly = typeof(TStartup).GetTypeInfo().Assembly; | |||
var applicationName = startupAssembly.GetName().Name; | |||
var library = libraryManager.GetLibrary(applicationName); | |||
var applicationRoot = Path.GetDirectoryName(library.Path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to reset the hostingEnvironment
still? Doesn't it rebase itself on the new app base?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't checked. Let me verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. Removed
4f5bdc7
to
f56cf97
Compare
.ConfigureServices( | ||
services => InitializeServices(startupTypeInfo.Assembly, services, configureServices)); | ||
.ConfigureServices(InitializeServices) | ||
.UseStartup(typeof(TStartup)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: UseStartup<TStartup>()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I end up having to annotate TStartup : new()
. It's less code this way :)
Looks good besides CI failure? |
@pranavkm - this is super nice cleanup. The other part of this item... what else would a user need to do to integration test their site? What tasks is the fixture currently performing that the hosting builder is not performing? (Ignore things like test logger and test encoder, which our users probably don't care about by default). |
@rynowak setting the app base is the main one. If we override that by handling it at the |
The StaticAssemblyProvider bit is also something a user would need to setup. If we change Mvc to not perform controller discovery and instead use a list provided at startup, this would go away.
That seems fine to me. |
No description provided.