Example #1
0
        public void Setup()
        {
            List <ServiceDescriptor> descriptors = new List <ServiceDescriptor>();

            services = new Mock <IServiceCollection>();
            services
            .Setup(instance => instance.GetEnumerator())
            .Returns(descriptors.GetEnumerator());

            configuration = new JwtConfiguration
            {
                Audience = "some audience",
                Expiry   = TimeSpan.FromDays(1),
                Issuer   = "some issuer"
            };

            ExtensionsHelper.AddJwt(services.Object, configuration);
        }
        public void WithoutAConfiguration_ThenAnErrorIsThrown()
        {
            ArgumentNullException exception = Assert.Throws <ArgumentNullException>(() => ExtensionsHelper.AddJwt(Mock.Of <IServiceCollection>(), null));

            Assert.AreEqual("configuration", exception.ParamName);
        }
        public void WithoutAServiceCollection_ThenAnErrorIsThrown()
        {
            ArgumentNullException exception = Assert.Throws <ArgumentNullException>(() => ExtensionsHelper.AddJwt(null, new JwtConfiguration()));

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