public void should_allow_emitting_events() { var handler = CreateHandler <AllowEmittingEventsEntity>(); var ctx = new MockCommandContextRef(); Assert.Equal( new Wrapped("blah"), DecodeWrapped(handler.HandleCommand(Command.Create("blah"), ctx.Object)) ); Assert.Equal("blah event", ctx.Emitted[0]); }
public void should_fail_on_bad_context_type() { var ex = Assert.Throws <CloudStateException>(() => { var handler = CreateHandler <BadContextTypeEntity>(); var ctx = new MockCommandContextRef(); Assert.Equal( new Wrapped("blah"), DecodeWrapped(handler.HandleCommand(Command.Create("blah"), ctx.Object)) ); Assert.Equal("blah event", ctx.Emitted[0]); }); Assert.StartsWith("Unsupported context parameter on [AddItem]", ex.Message); }