public void AddActionWithInvalidTypeTest() { var collection = new ActionCollection <string>(); Assert.Throws <InvalidOperationException>(() => collection.AddAction(typeof(string))); Assert.Throws <InvalidOperationException>(() => collection.AddAction(typeof(IAction <string>))); }
public GroupDataBinding(string groupDataBindingName) { ResourceName = groupDataBindingName; var groupDataBindingAction = new GroupBindingAction("GroupBindingAction", this); _actions.AddAction(groupDataBindingAction); }
public void AddActionsTest() { var collection = new ActionCollection <IActionTracingContainer>(); collection.AddAction <DummyActionOne>(); collection.AddAction(typeof(DummyActionTwo)); Assert.True(collection.Count() == 2); Assert.Equal(typeof(DummyActionOne), collection.ElementAt(0).ActionType); Assert.Equal(typeof(DummyActionTwo), collection.ElementAt(1).ActionType); }
public void AddActionsWithPriorityTest() { var collection = new ActionCollection <IActionTracingContainer>(); collection.AddAction <DummyActionOne>(4); collection.AddAction(typeof(DummyActionTwo), 1); collection.AddAction(typeof(DummyActionThree), 3); collection.AddAction(typeof(DummyActionFour), 3); Assert.True(collection.Count() == 4); Assert.Equal(typeof(DummyActionTwo), collection.ElementAt(0).ActionType); Assert.Equal(typeof(DummyActionThree), collection.ElementAt(1).ActionType); Assert.Equal(typeof(DummyActionFour), collection.ElementAt(2).ActionType); Assert.Equal(typeof(DummyActionOne), collection.ElementAt(3).ActionType); }
public async Task ActionSimpleExportTest() { var collection = new ActionCollection <IActionTracingContainer>(); collection.AddAction <DummyActionTwo>(); collection.AddAction <DummyActionOne>(); var exportProvider = new ActionExportProvider(); var sequence = new ActionSequence <IActionTracingContainer>(collection, exportProvider); var result = await sequence.ExecuteAsync(null); Assert.Equal(ActionSequenceExecutionResult.Full, result); Assert.NotNull(exportProvider.GetExport(typeof(DummyActionTwoExport), null)); }
public async Task ActionSequenceNoneExecutionTest() { var collection = new ActionCollection <IActionTracingContainer>(); collection.AddAction <DummyActionThree>(); collection.AddAction <DummyActionOne>(); var sequence = new ActionSequence <IActionTracingContainer>(collection); var container = this.GetMockedTracingContainer(); var result = await sequence.ExecuteAsync(container); Assert.Equal(ActionSequenceExecutionResult.None, result); Assert.True(this.MatchTraceEntry(container, 0, ActionTraceEvent.Begin, "ActionSequence (2)")); Assert.True(this.MatchTraceEntry(container, 1, ActionTraceEvent.End, "ActionSequence (2)")); }
public async Task ActionSequencePartialExecutionTest() { var collection = new ActionCollection <IActionTracingContainer>(); collection.AddAction <DummyActionTwo>(); collection.AddAction <DummyActionFour>(); var sequence = new ActionSequence <IActionTracingContainer>(collection); var container = this.GetMockedTracingContainer(); var result = await sequence.ExecuteAsync(container); Assert.Equal(ActionSequenceExecutionResult.Partial, result); Assert.True(this.MatchTraceEntry(container, 0, ActionTraceEvent.Begin, "ActionSequence (2)")); Assert.True(this.MatchTraceEntry(container, 1, ActionTraceEvent.Begin, "ActionBundle (1)")); Assert.True(this.MatchTraceEntry(container, 2, ActionTraceEvent.Begin, nameof(DummyActionTwo))); Assert.True(this.MatchTraceEntry(container, 3, ActionTraceEvent.End, nameof(DummyActionTwo))); Assert.True(this.MatchTraceEntry(container, 4, ActionTraceEvent.End, "ActionBundle (1)")); Assert.True(this.MatchTraceEntry(container, 5, ActionTraceEvent.End, "ActionSequence (2)")); }
public async Task ThrowsForActionExceptionTest() { var collection = new ActionCollection <IActionTracingContainer>(); collection.AddAction <ActionWhichThrowsActionException>(); var sequence = new ActionSequence <IActionTracingContainer>(collection); var container = this.GetMockedTracingContainer(); var exception = await Assert.ThrowsAsync <ActionException>( async() => await sequence.ExecuteAsync(container)); Assert.Equal("TEST", exception.Message); Assert.True(this.MatchTraceEntry(container, 0, ActionTraceEvent.Begin, "ActionSequence (1)")); Assert.True(this.MatchTraceEntry(container, 1, ActionTraceEvent.Begin, "ActionBundle (1)")); Assert.True(this.MatchTraceEntry(container, 2, ActionTraceEvent.Begin, nameof(ActionWhichThrowsActionException))); Assert.True(this.MatchTraceEntry(container, 3, ActionTraceEvent.UnexpectedEnd, nameof(ActionWhichThrowsActionException))); Assert.True(this.MatchTraceEntry(container, 4, ActionTraceEvent.UnexpectedEnd, "ActionBundle (1)")); Assert.True(this.MatchTraceEntry(container, 5, ActionTraceEvent.UnexpectedEnd, "ActionSequence (1)")); }
public void AddAction(BaseAction action) { Actions.AddAction(action); }