Example #1
0
        public void ThrowsExceptionWhenConfigurationIsNull()
        {
            var builder  = new Mock <IConfigurationBuilder>();
            var services = new Mock <IServiceCollection>();

            var target = new ConfigurationBuilderRegistration(builder.Object, services.Object, _ => { });

            Assert.Throws <BuildException>(() => target.Register());
            builder.Verify(o => o.Build(), Times.Once);
        }
Example #2
0
        public void RegistersTheConfigurationAsSingleton()
        {
            var configuration = new Mock <IConfigurationRoot>();

            var builder = new Mock <IConfigurationBuilder>();

            builder.Setup(o => o.Build()).Returns(configuration.Object);

            var services = new Mock <IServiceCollection>();

            var target = new ConfigurationBuilderRegistration(builder.Object, services.Object, _ => { });

            target.Register();

            builder.Verify(o => o.Build(), Times.Once);
        }