public void WithAServiceCollection_ThenATokenServiceIsAdded() { Mock <IServiceCollection> services = new Mock <IServiceCollection>(); ExtensionsHelper.AddTokenService(services.Object); services.Verify(instance => instance.Add(It.Is <ServiceDescriptor>(x => x.Lifetime == ServiceLifetime.Scoped && x.ServiceType == typeof(ITokenService) && x.ImplementationType == typeof(TokenService))), Times.Once); }
public void WithoutAServiceCollection_ThenAnExceptionIsThrown() { ArgumentNullException exception = Assert.Throws <ArgumentNullException>(() => ExtensionsHelper.AddTokenService(null)); Assert.AreEqual("services", exception.ParamName); }