public void BlazorBreakdanceTestBase_Setup_CreatesTestContext_ConflictingServices()
 {
     BUnitTestContext.Should().NotBeNull();
     RegisterServices.Should().NotBeNull();
     BUnitTestContext.Services.Should().HaveCount(14);
     GetService <NavigationManager>().Should().NotBeNull().And.BeOfType(typeof(FakeNavigationManager));
     GetServices <NavigationManager>().Should().HaveCount(1);
     GetService <TestableNavigationManager>().Should().NotBeNull();
 }
        public void BlazorBreakdanceTestBase_TestSetup_CreatesTestContext_Services()
        {
            //RWM: We're not *quite* setting this up properly, because we want to test the state both before and after calling TestSetup();
            TestHost.Should().BeNull();
            BUnitTestContext.Should().BeNull();
            RegisterServices.Should().BeNull();

            RegisterServices = services => {
                services.AddScoped <NavigationManager>(sp => new TestableNavigationManager());
            };
            TestSetup();

            TestHost.Should().NotBeNull();
            BUnitTestContext.Should().NotBeNull();
            RegisterServices.Should().NotBeNull();
            BUnitTestContext.Services.Should().HaveCount(14);
            GetService <NavigationManager>().Should().NotBeNull().And.BeOfType(typeof(TestableNavigationManager));
            GetServices <NavigationManager>().Should().HaveCount(2);
        }
        public void BlazorBreakdanceTestBase_Setup_CreatesTestContext_NoServices()
        {
            //RWM: We're not *quite* setting this up properly, because we want to test the state both before and after calling TestSetup();
            TestHost.Should().BeNull();
            BUnitTestContext.Should().BeNull();
            RegisterServices.Should().BeNull();
            GetService <IConfiguration>().Should().BeNull();

            TestSetup();

            TestHost.Should().NotBeNull();
            BUnitTestContext.Should().NotBeNull();
            RegisterServices.Should().BeNull();
#if NET6_0_OR_GREATER
            TestHost.Services.GetAllServiceDescriptors().Should().HaveCount(33);
#endif
#if NET5_0
            TestHost.Services.GetAllServiceDescriptors().Should().HaveCount(32);
#endif
            BUnitTestContext.Services.Should().HaveCount(13);
            GetService <NavigationManager>().Should().NotBeNull().And.BeOfType(typeof(FakeNavigationManager));
            BUnitTestContext.Services.GetService <IConfiguration>().Should().NotBeNull();
        }
        public void BlazorBreakdanceTestBase_GetServices_ReturnsServiceOnlyInTestContext()
        {
            //RWM: We're not *quite* setting this up properly, because we want to test the state both before and after calling TestSetup();
            TestHost.Should().BeNull();
            BUnitTestContext.Should().BeNull();
            RegisterServices.Should().BeNull();

            TestHostBuilder.ConfigureServices((context, services) => services.AddSingleton <DummyService>());
            TestSetup();

            TestHost.Should().NotBeNull();
            BUnitTestContext.Should().NotBeNull();
            RegisterServices.Should().BeNull();
            BUnitTestContext.Services.Should().HaveCount(13);
            BUnitTestContext.Services.GetService <DummyService>().Should().BeNull();
#if NET6_0_OR_GREATER
            TestHost.Services.GetAllServiceDescriptors().Should().HaveCount(34);
#endif
#if NET5_0
            TestHost.Services.GetAllServiceDescriptors().Should().HaveCount(33);
#endif
            TestHost.Services.GetService <DummyService>().Should().NotBeNull();
            GetService <DummyService>().Should().NotBeNull();
        }