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))); }
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)); }
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)); }
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)); }