private StringBuilder RunOutput() { var esbMethod = new GetScheduledResources(); _factory = new Mock <IServerSchedulerFactory>(); var security = new Mock <ISecurityWrapper>(); esbMethod.SecurityWrapper = security.Object; var model = new Mock <IScheduledResourceModel>(); var ws = new Mock <IWorkspace>(); var trigger = new ScheduleTrigger(TaskState.Disabled, new Dev2DailyTrigger(new TaskServiceConvertorFactory(), new DailyTrigger(21)), new Dev2TaskService(new TaskServiceConvertorFactory()), new TaskServiceConvertorFactory()); var res = new ScheduledResource("a", SchedulerStatus.Enabled, DateTime.Now, trigger, "dave"); _factory.Setup( a => a.CreateModel(GlobalConstants.SchedulerFolderId, It.IsAny <ISecurityWrapper>())).Returns(model.Object); model.Setup(a => a.GetScheduledResources()).Returns(new ObservableCollection <IScheduledResource>() { res }); esbMethod.SchedulerFactory = _factory.Object; var output = esbMethod.Execute(new Dictionary <string, StringBuilder>(), ws.Object); return(output); }
public void GetAuthorizationContextForService_ShouldReturnContext() { //------------Setup for test-------------------------- var getScheduledResources = new GetScheduledResources(); //------------Execute Test--------------------------- var resId = getScheduledResources.GetAuthorizationContextForService(); //------------Assert Results------------------------- Assert.AreEqual(AuthorizationContext.Any, resId); }
public void GetResourceID_ShouldReturnEmptyGuid() { //------------Setup for test-------------------------- var getScheduledResources = new GetScheduledResources(); //------------Execute Test--------------------------- var resId = getScheduledResources.GetResourceID(new Dictionary <string, StringBuilder>()); //------------Assert Results------------------------- Assert.AreEqual(Guid.Empty, resId); }
public void GetScheduledResourcesReturnsDynamicService() { var esb = new GetScheduledResources(); var result = esb.CreateServiceEntry(); Assert.AreEqual(esb.HandlesType(), result.Name); Assert.AreEqual("<DataList></DataList>", result.DataListSpecification.ToString()); Assert.AreEqual(1, result.Actions.Count); var serviceAction = result.Actions[0]; Assert.AreEqual(esb.HandlesType(), serviceAction.Name); Assert.AreEqual(enActionType.InvokeManagementDynamicService, serviceAction.ActionType); Assert.AreEqual(esb.HandlesType(), serviceAction.SourceMethod); }
public void GetScheduledResources_ServiceName() { var esbMethod = new GetScheduledResources(); Assert.AreEqual("GetScheduledResources", esbMethod.HandlesType()); }