public void Register_generic_Should_not_throw_When_registrering_same_type_more_than_once()
        {
            var configs = new StructureTypeConfigurations();

            configs.Register <Dummy>();

            Action action = () => configs.Register <Dummy>();

            action.Should().NotThrow();
        }
        public void Register_with_null_config_Should_add_config_with_exclusive_mode()
        {
            var configs = new StructureTypeConfigurations();

            configs.Register(typeof(Dummy));

            configs.Should().HaveCount(1);
            configs.First().IndexMode.Should().Be(IndexMode.Exclusive);
        }
        public void Register_generic_with_empty_config_Should_add_config_with_exclusive_mode()
        {
            var configs = new StructureTypeConfigurations();

            configs.Register <Dummy>(cfg => { });

            configs.Should().HaveCount(1);
            configs.First().IndexMode.Should().Be(IndexMode.Exclusive);
        }
Esempio n. 4
0
        internal static IStructureType CreateFor <T>() where T : class
        {
            var configs = new StructureTypeConfigurations();
            var factory = new StructureTypeFactory();

            var typeConfig = configs.Register <T>();

            return(factory.CreateFor(typeConfig));
        }
        public void GetConfigurations_Should_return_config_When_registrated_via_generic_version()
        {
            var configs = new StructureTypeConfigurations();

            configs.Register <Dummy>(cfg => { });

            var config = configs.GetConfiguration(typeof(Dummy));

            Assert.IsNotNull(config);
            Assert.AreEqual(typeof(Dummy), config.Type);
        }