public void Pilet_Services_Registration_Should_Be_Commutative()
        {
            // global registrations
            var globalServices       = new ServiceCollection();
            var prialServiceProvider = new PiralServiceProvider(globalServices);

            // moduleC registrations
            var moduleCServices = new ServiceCollection();

            moduleCServices.AddTransient <ModuleCDependency>();
            var moduleCServiceProvider = prialServiceProvider.CreatePiletServiceProvider(moduleCServices);

            // moduleA registrations
            var moduleAGlobalServices = new ServiceCollection();

            moduleAGlobalServices.AddSingleton <ModuleAGlobalDependency>();
            prialServiceProvider.AddGlobalServices(moduleAGlobalServices);

            var moduleAServices        = new ServiceCollection();
            var moduleAServiceProvider = prialServiceProvider.CreatePiletServiceProvider(moduleAServices);

            // resolve dependencies
            var moduleAGlobalDependency = moduleAServiceProvider.GetRequiredService <ModuleAGlobalDependency>();
            var moduleCDependency       = moduleCServiceProvider.GetRequiredService <ModuleCDependency>();

            // assert
            moduleAGlobalDependency.Should().Be(moduleCDependency.Dependency);
        }
        public void Pilet_Services_Should_Resolve_Global_Dependencies()
        {
            // global registrations
            var globalServices = new ServiceCollection();

            globalServices.AddSingleton <GlobalDependency>();
            var piralServiceProvider = new PiralServiceProvider(globalServices);
            var globalDependency     = piralServiceProvider.GetRequiredService <GlobalDependency>();

            // moduleA registrations
            var moduleAServices = new ServiceCollection();

            moduleAServices.AddTransient <ModuleADependency>();
            var moduleAServiceProvider = piralServiceProvider.CreatePiletServiceProvider(moduleAServices);
            var moduleADependency      = moduleAServiceProvider.GetRequiredService <ModuleADependency>();

            globalDependency.Should().Be(moduleADependency.Dependency);

            // moduleB registrations
            var moduleBServices = new ServiceCollection();

            moduleBServices.AddTransient <ModuleBDependency>();
            var moduleBServiceProvider = piralServiceProvider.CreatePiletServiceProvider(moduleBServices);
            var moduleBDependency      = moduleBServiceProvider.GetRequiredService <ModuleBDependency>();

            globalDependency.Should().Be(moduleBDependency.Dependency);
        }