public MessageComposer(IContainer container) { serializer = container.Resolve <ISerializer>(); compression = container.Resolve <ICompression>(); encryption = container.Resolve <IEncryption>(); commandHolder = container.Resolve <ICommandHolder>(); arrayPool = container.Resolve <IArrayPool>(); }
public CommandRaiser(IContainerConfig config) { this.config = config; using (var container = config.Create()) { commandHolder = container.Resolve <ICommandHolder>(); } }
public void InvokeCommandAgainstICommandInTargetRespectsCanExecuteWindow() { var executed = false; var canExecute = new BehaviorSubject<bool>(false); var fixture = new ICommandHolder(); var source = new Subject<Unit>(); source.InvokeCommand(fixture, x => x.TheCommand); fixture.TheCommand = ReactiveCommand.Create(() => executed = true, canExecute); source.OnNext(Unit.Default); Assert.False(executed); // The execution window re-opens, but the above execution request should not be instigated because // it occurred when the window was closed. Execution requests do not queue up when the window is closed. canExecute.OnNext(true); Assert.False(executed); }
public void InvokeCommandAgainstICommandInTargetRespectsCanExecute() { var executed = false; var canExecute = new BehaviorSubject<bool>(false); var fixture = new ICommandHolder(); var source = new Subject<Unit>(); source.InvokeCommand(fixture, x => x.TheCommand); fixture.TheCommand = ReactiveCommand.Create(() => executed = true, canExecute); source.OnNext(Unit.Default); Assert.False(executed); canExecute.OnNext(true); source.OnNext(Unit.Default); Assert.True(executed); }
public void InvokeCommandAgainstICommandInTargetPassesTheSpecifiedValueToCanExecuteAndExecute() { var fixture = new ICommandHolder(); var source = new Subject<int>(); source.InvokeCommand(fixture, x => x.TheCommand); var command = new FakeCommand(); fixture.TheCommand = command; source.OnNext(42); Assert.Equal(42, command.CanExecuteParameter); Assert.Equal(42, command.ExecuteParameter); }
public void InvokeCommandAgainstICommandInTargetInvokesTheCommand() { var executionCount = 0; var fixture = new ICommandHolder(); var source = new Subject<Unit>(); source.InvokeCommand(fixture, x => x.TheCommand); fixture.TheCommand = ReactiveCommand.Create(() => ++executionCount); source.OnNext(Unit.Default); Assert.Equal(1, executionCount); source.OnNext(Unit.Default); Assert.Equal(2, executionCount); }