public void CqrsBuilder_ThrowsException_OnInvalidHandlerRegistration() { //Arrange var builder = new CqrsBuilder(); //Act Assert Assert.Throws <InvalidCastException>(() => builder.Register(typeof(InvalidEventHandler))); Assert.Throws <InvalidCastException>(() => builder.Register(typeof(InvalidCommandHandler))); Assert.Throws <InvalidCastException>(() => builder.RegisterDefaultHandler(typeof(InvalidCommandHandler))); }
public void CqrsBuilder_ThrowsException_OnNullRegistration() { //Arrange var builder = new CqrsBuilder(); //Act Assert Assert.Throws <ArgumentNullException>(() => builder.Register(null)); Assert.Throws <ArgumentNullException>(() => builder.RegisterDefaultHandler(null)); Assert.Throws <ArgumentNullException>(() => builder.AutoRegisterHandlers(null)); Assert.Throws <ArgumentNullException>(() => builder.RegisterContainer(null)); Assert.Throws <ArgumentNullException>(() => builder.RegisterResolver(null)); }