private void GetClass_WithAllInterfaces()
        {
            // act
            serviceCollection.ResolveDependencies();
            serviceProvider = serviceCollection.BuildServiceProvider();

            IClassMultiple1 service1 = serviceProvider.GetService <IClassMultiple1>();
            IClassMultiple2 service2 = serviceProvider.GetService <IClassMultiple2>();

            // assert
            service1.Should().NotBeNull().And.BeOfType <ClassWithMultipleInterfaces>();
            service2.Should().NotBeNull().And.BeOfType <ClassWithMultipleInterfaces>();
        }
Esempio n. 2
0
        private void GetClass_InjectAllWithMatchingOverride()
        {
            // act
            serviceCollection.ResolveDependencies(o => { o.UseOverride("myOverride"); });
            serviceProvider = serviceCollection.BuildServiceProvider();

            IClassMultiple1 service1 = serviceProvider.GetService <IClassMultiple1>();
            IClassMultiple2 service2 = serviceProvider.GetService <IClassMultiple2>();
            IClassMultiple3 service3 = serviceProvider.GetService <IClassMultiple3>();

            // assert
            service1.Should().NotBeNull().And.BeOfType <InjectAllOverrideClass>();
            service2.Should().NotBeNull().And.BeOfType <InjectAllOverrideClass>();
            service3.Should().NotBeNull().And.BeOfType <InjectAllOverrideClass>();
        }