Exemplo n.º 1
0
        public void AssertIsValid_does_not_throw_when_implementation_type_is_same_as_service_type(ISelectsConstructor ctorSelector)
        {
            // Arrange
            var sut = new OpenGenericTypeRegistration(typeof(GenericService <>), ctorSelector)
            {
                ServiceType = typeof(GenericService <>),
            };

            // Act & assert
            Assert.That(() => sut.AssertIsValid(), Throws.Nothing);
        }
Exemplo n.º 2
0
        public void AssertIsValid_throws_exception_if_implementation_type_does_not_derive_from_service_type(ISelectsConstructor ctorSelector)
        {
            // Arrange
            var sut = new OpenGenericTypeRegistration(typeof(GenericService <>), ctorSelector)
            {
                ServiceType = typeof(IOtherGenericService <>),
            };

            // Act & assert
            Assert.That(() => sut.AssertIsValid(), Throws.InstanceOf <InvalidTypeRegistrationException>());
        }