MyTested.AspNetCore.Mvc icon indicating copy to clipboard operation
MyTested.AspNetCore.Mvc copied to clipboard

Provide an easy way to validate whether a service is missing

Open ivaylokenov opened this issue 5 years ago • 0 comments

Instead of validating services by hand. Additionally, validate every replaced service, because a user may replace something that is actually missing, and may think the services are working correctly.

public void ConfigureTestServices(IServiceCollection services)
        {
            base.ConfigureServices(services);

            ValidateServices(services);

            services.ReplaceTransient<UserManager<User>>(_ => IdentityFakes.FakeUserManager);
            services.ReplaceTransient<IJwtTokenGenerator>(_ => JwtTokenGeneratorFakes.FakeJwtTokenGenerator);
        }

ivaylokenov avatar May 26 '20 15:05 ivaylokenov