Exemplo n.º 1
0
        public void WithAServiceCollection_ThenATokenServiceIsAdded()
        {
            Mock <IServiceCollection> services = new Mock <IServiceCollection>();

            ExtensionsHelper.AddValidationService(services.Object);

            services.Verify(instance => instance.Add(It.Is <ServiceDescriptor>(x =>
                                                                               x.Lifetime == ServiceLifetime.Scoped &&
                                                                               x.ServiceType == typeof(IValidatorService))), Times.Once);
        }
Exemplo n.º 2
0
        public void WithoutAServiceCollection_ThenAnExceptionIsThrown()
        {
            ArgumentNullException exception = Assert.Throws <ArgumentNullException>(() => ExtensionsHelper.AddValidationService(null));

            Assert.AreEqual("services", exception.ParamName);
        }