public void CommandBinding_InGlobal_Exception() { // Arrange var actual = false; var container = new CommandContainerTest(); var key = typeof(object); var binder = new CommandBinding(container, key, null, null); binder.InGlobal(); // Act try { binder.InGlobal(); } catch (InvalidOperationException) { actual = true; } // Assert Assert.IsTrue(actual); }
public void CommandBinding_InGlobal() { // Arrange var container = new CommandContainerTest(); var key = typeof(object); var binder = new CommandBinding(container, key, null, null); // Act binder.InGlobal(); var actual = binder.LifeTime; // Assert Assert.AreEqual(LifeTime.Global, actual); }
public void CommandBinding_InParallel() { // Arrange var container = new CommandContainerTest(); var key = typeof(object); var binder = new CommandBinding(container, key, null, null); binder.InGlobal().InParallel(); // Act var actual = binder.IsSequence; // Assert Assert.IsFalse(actual); }
public void CommandBinding_ExecuteAndInParallel() { // Arrange var container = new CommandContainerTest(); var key = typeof(object); var binder = new CommandBinding(container, key, null, null); // Act binder.InGlobal() .InParallel() .To <CommandTest>() .Execute(); var actual = container.IsExecuted; // Assert Assert.IsTrue(actual); }
public void CommandBinding_InSequenceAnd2To() { // Arrange var container = new CommandContainerTest(); var key = typeof(object); var binder = new CommandBinding(container, key, null, null); // Act binder.InGlobal() .InSequence() .To <CommandTest>() .To <CommandTest>(); var values = binder.Values; var actual = values.Count(); // Assert Assert.AreEqual(2, actual); }