Exemplo n.º 1
0
        public void when_registering_multiple_types_then_the_type_can_be_found()
        {
            var sut = new ConfigurableSerializationTypeMap();

            sut.RegisterTypes(typeof(OrderCreated).GetTypeInfo().Assembly, t => t.Namespace != null && t.Namespace.EndsWith("Events"), t => t.Name);

            Assert.That(sut.GetTypeFromName("OrderCreated"), Is.EqualTo(typeof(OrderCreated)));
        }
Exemplo n.º 2
0
        public void when_registering_multiple_types_if_no_types_are_found_then_an_exception_is_thrown()
        {
            var sut = new ConfigurableSerializationTypeMap();

            Assert.Throws <NoTypesFoundException>(() => sut.RegisterTypes(typeof(OrderCreated).GetTypeInfo().Assembly, t => false, t => t.Name));
        }
Exemplo n.º 3
0
        public void when_registering_types_with_a_null_naming_function_then_an_exception_is_thrown()
        {
            var sut = new ConfigurableSerializationTypeMap();

            Assert.Throws <ArgumentNullException>(() => sut.RegisterTypes(typeof(OrderCreated).GetTypeInfo().Assembly, t => true, null));
        }
Exemplo n.º 4
0
        public void when_registering_types_with_a_null_assembly_then_an_exception_is_thrown()
        {
            var sut = new ConfigurableSerializationTypeMap();

            Assert.Throws <ArgumentNullException>(() => sut.RegisterTypes(null, t => true, t => t.Name));
        }