public void Returns_different_provider_for_different_tyoe_of_configured_extensions()
        {
            var config1 = CreateOptions(new FakeDbContextOptionsExtension1());
            var config2 = CreateOptions(new FakeDbContextOptionsExtension2());

            var cache = new ServiceProviderCache();

            Assert.NotSame(cache.GetOrAdd(config1), cache.GetOrAdd(config2));
        }
        public void Returns_different_provider_for_configured_services_differing_by_instance()
        {
            var config1 = CreateOptions(b =>
                {
                    b.GetService().AddSingleton<IFakeServiceA, FakeService1>();
                    b.GetService().AddSingleton<FakeService3>();
                    b.GetService().AddInstance(new FakeService4());
                });

            var config2 = CreateOptions(b =>
                {
                    b.GetService().AddSingleton<IFakeServiceA, FakeService1>();
                    b.GetService().AddSingleton<FakeService3>();
                    b.GetService().AddInstance(new FakeService4());
                });

            var cache = new ServiceProviderCache();

            Assert.NotSame(cache.GetOrAdd(config1), cache.GetOrAdd(config2));
        }
        public void Returns_same_provider_for_same_set_of_configured_services()
        {
            var serviceInstance = new FakeService4();

            var config1 = CreateOptions(b =>
                {
                    b.GetService().AddSingleton<IFakeServiceA, FakeService1>();
                    b.GetService().AddSingleton<FakeService3>();
                    b.GetService().AddInstance(serviceInstance);
                });

            var config2 = CreateOptions(b =>
                {
                    b.GetService().AddSingleton<IFakeServiceA, FakeService1>();
                    b.GetService().AddSingleton<FakeService3>();
                    b.GetService().AddInstance(serviceInstance);
                });

            var cache = new ServiceProviderCache();

            Assert.Same(cache.GetOrAdd(config1), cache.GetOrAdd(config2));
        }