Exemplo n.º 1
0
        public void Should_allow_to_replace_a_component_with_another_one_via_generic_overload()
        {
            var sut = new ServiceComponentList <ITestComponent>();

            sut.Register(new TestComponentImpl());
            sut.Replace <TestComponentImpl, AnotherImpl>();

            sut.Should().NotBeEmpty();
            sut.Should().AllBeOfType <AnotherImpl>();
        }
Exemplo n.º 2
0
        public void Should_allow_to_replace_a_component_with_another_one()
        {
            var sut          = new ServiceComponentList <ITestComponent>();
            var oldComponent = new TestComponentImpl();
            var newComponent = new TestComponentImpl();

            sut.Register(oldComponent);
            sut.Replace(oldComponent, newComponent);

            sut.Should().Equal(newComponent);
        }