Shared VerifyFrameworkServicesTest helper
Closed this issue · 6 comments
HaoK commented
So I think we can now have a shared test method which validates AddXyz setups ApplicationServices properly now that we can do this in a standard way for all of the AddFramework() methods...
cc @davidfowl @divega Thoughts?
public void VerifyAddFrameworkServices(Action<IServiceCollection> addServices, IEnumerable<Type> requiredServices>) {
var context = new HostingContext();
addServices(context.Services);
var appServices = HostingEngine.CreateApplicationServices(context);
foreach (var serviceType in requiredServices) {
Assert.NotNull(appServices.GetRequiredService(serviceType));
}
}
[Fact]
void VerifyAddIdentity() {
VerifyAddFrameworkServices(services => services.AddIdentity<TUser, TRole>(),
new Type[] { typeof(UserManager<TUser, TRole>), typeof(RoleManager<TRole>));
}
HaoK commented
Sure, I'm guessing most repos have some form of verifying this already, but could be useful to standardize
Eilon commented
I put it on your plate for beta7.
HaoK commented
Didn't get a chance to get to this for beta 7 it looks like. Backlog might be better than beta 8 at this point I'm guessing
Eilon commented
Alright with me.
Eilon commented
Ancient bug and doesn't look like we need/care anymore.