public void ExecuteError() { var configuration = new CommandConfiguration<FakeCommand>(); var success = false; var progressCalled = false; var coreExecuted = false; var failExecuted = false; var command = new FakeCommand { CoreExecuted = () => { throw new NotImplementedException(); } }; configuration.ConstructUsing(() => command); configuration.OnSuccess((s) => success = true); configuration.OnProgress((p) => progressCalled = true); configuration.OnFailure((f) => failExecuted = true); configuration.Execute(); Assert.False(success); Assert.False(progressCalled); Assert.False(coreExecuted); Assert.True(failExecuted); }
public void ConstructUsing() { var configuration = new CommandConfiguration<FakeCommand>(); var command = new FakeCommand(); configuration.ConstructUsing(() => command); Assert.AreEqual(command, configuration.Command); }
public void ExecutePositive() { var configuration = new CommandConfiguration<FakeCommand>(); var success = false; var progressCalled = false; var coreExecuted = false; var command = new FakeCommand { CoreExecuted = () => coreExecuted = true }; configuration.ConstructUsing(() => command); configuration.OnSuccess((s) => success = true); configuration.OnProgress((p) => progressCalled = true); configuration.Execute(); Assert.True(success); Assert.False(progressCalled); Assert.True(coreExecuted); }
public void Constructor() { var configuration = new CommandConfiguration<FakeCommand>(); Assert.IsNotNull(configuration); }