public void EditResource_UnitTest_EditResourceWhereNullEventAggregator_ExpectException() { //------------Setup for test-------------------------- var mockResourceModel = new Mock <IResourceModel>(); mockResourceModel.Setup(model => model.ResourceType).Returns(ResourceType.Service); var eventAggregator = new EventAggregator(); var handleMessages = new TestHandleMessages(); eventAggregator.Subscribe(handleMessages); //------------Execute Test--------------------------- WorkflowDesignerUtils.EditResource(mockResourceModel.Object, null); //------------Assert Results------------------------- }
public void EditResource_UnitTest_EditResourceWhereWorkflow_ExpectAddWorksurfaceMessageHandled() { //------------Setup for test-------------------------- var mockResourceModel = new Mock <IResourceModel>(); mockResourceModel.Setup(model => model.ResourceType).Returns(ResourceType.WorkflowService); var eventAggregator = new EventAggregator(); var handleMessages = new TestHandleMessages(); eventAggregator.Subscribe(handleMessages); //------------Execute Test--------------------------- WorkflowDesignerUtils.EditResource(mockResourceModel.Object, eventAggregator); //------------Assert Results------------------------- Assert.IsTrue(handleMessages.WorkSurfaceMessageCalled); Assert.IsFalse(handleMessages.EditResourceMessageCalled); }