public void Should_not_throw_propertyType_is_not_serializable_if_a_IDataBusSerializer_is_already_registered() { if (!Debugger.IsAttached) { Assert.Ignore("This only work in debug mode."); } var builder = new BusConfiguration(); builder.EndpointName("xyz"); builder.TypesToScan(new[] { typeof(MessageWithNonSerializableDataBusProperty) }); builder.Conventions().DefiningDataBusPropertiesAs(p => p.Name.EndsWith("DataBus")); builder.RegisterComponents(c => { c.RegisterSingleton<IDataBus>(new InMemoryDataBus()); c.ConfigureComponent<IDataBusSerializer>(() => new MyDataBusSerializer(), DependencyLifecycle.SingleInstance); }); var config = builder.BuildConfiguration(); var feature = new DataBusFileBased(); Assert.DoesNotThrow(() => feature.CheckPrerequisites(new FeatureConfigurationContext(config))); }
public void Should_throw_if_propertyType_is_not_serializable() { if (!Debugger.IsAttached) { Assert.Ignore("This only work in debug mode."); } var builder = new BusConfiguration(); builder.EndpointName("xyz"); builder.TypesToScan(new[] { typeof(MessageWithNonSerializableDataBusProperty) }); builder.Conventions().DefiningDataBusPropertiesAs(p => p.Name.EndsWith("DataBus")); var feature = new DataBusFileBased(); Assert.Throws<InvalidOperationException>(() => feature.CheckPrerequisites(new FeatureConfigurationContext(builder.BuildConfiguration()))); }