Пример #1
0
        public void Should_ignore_unregistration_of_nonexisting_component_via_generic_overload()
        {
            var sut = new ServiceComponentList <ITestComponent>();

            sut.Register(new TestComponentImpl());
            sut.Unregister <AnotherImpl>();

            sut.Should().NotBeEmpty();
        }
Пример #2
0
        public void Should_ignore_unregistration_of_nonexisting_component()
        {
            var sut = new ServiceComponentList <ITestComponent>();

            sut.Register(new TestComponentImpl());
            sut.Unregister(new TestComponentImpl());

            sut.Should().NotBeEmpty();
        }
Пример #3
0
        public void Should_allow_unregistration_of_existing_component_via_generic_overload()
        {
            var sut = new ServiceComponentList <ITestComponent>();

            sut.Register(new TestComponentImpl());
            sut.Unregister <TestComponentImpl>();

            sut.Should().BeEmpty();
        }
Пример #4
0
        public void Should_allow_unregistration_of_existing_component()
        {
            var sut       = new ServiceComponentList <ITestComponent>();
            var component = new TestComponentImpl();

            sut.Register(component);
            sut.Unregister(component);

            sut.Should().BeEmpty();
        }
Пример #5
0
        public void Should_allow_the_removal_of_default_component_via_generic_unregistration()
        {
            var sut             = new ServiceComponentList <ITestComponent>();
            var registeredFirst = new TestComponentImpl();

            sut.Register(registeredFirst);
            sut.SetDefault <AnotherImpl>();
            sut.Unregister <ITestComponent>();

            sut.Should().BeEmpty();
        }
Пример #6
0
        public void Should_allow_the_unregistration_of_default_components()
        {
            var sut             = new ServiceComponentList <ITestComponent>();
            var registeredFirst = new TestComponentImpl();
            var registeredLast  = new TestComponentImpl();
            var @default        = new TestComponentImpl();

            sut.Register(registeredFirst);
            sut.Register(registeredLast);
            sut.SetDefault(@default);
            sut.Unregister(@default);

            sut.Should().Equal(registeredLast, registeredFirst);
        }