public void ResourceModel_GetWorkflowXaml_IsNull() { //------------Setup for test-------------------------- Setup(); var eventPublisher = new EventPublisher(); var environmentModel = CreateMockEnvironment(eventPublisher); var msg = MakeMessage("test"); var repo = new Mock <IResourceRepository>(); repo.Setup(repository => repository.FetchResourceDefinition(It.IsAny <IServer>(), It.IsAny <Guid>(), It.IsAny <Guid>(), It.IsAny <bool>())).Returns(msg); environmentModel.Setup(e => e.ResourceRepository).Returns(repo.Object); var instanceID = Guid.NewGuid(); var resourceModel = new ResourceModel(environmentModel.Object) { ID = instanceID, WorkflowXaml = null, ResourceType = ResourceType.WorkflowService }; var workflowXaml = resourceModel.GetWorkflowXaml(); Assert.AreEqual(msg.Message, workflowXaml); }
public void ResourceModel_GetWorkflowXaml_NotNull() { //------------Setup for test-------------------------- Setup(); var eventPublisher = new EventPublisher(); var environmentModel = CreateMockEnvironment(eventPublisher); var instanceID = Guid.NewGuid(); var resourceModel = new ResourceModel(environmentModel.Object) { ID = instanceID, WorkflowXaml = null, ResourceType = ResourceType.WorkflowService }; var xaml = new StringBuilder("new xaml"); resourceModel.WorkflowXaml = xaml; var workflowXaml = resourceModel.GetWorkflowXaml(); Assert.AreEqual(xaml, workflowXaml); }