public void TestInitialize()
        {
            _tasks = new List <Task>
            {
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler           = TaskHandlerNames.ProvisioningHandler;
                    task.Name              = TaskNames.CaseSiteProvisioning;
                    task.NextScheduledDate = DateTime.Now.AddDays(-1);
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.OperationsHandler;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.OperationsHandler;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.OperationsHandler;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.SupportHandler;
                })
            };

            _mockTaskService = new Mock <ITaskService>();
            _mockTaskService.Setup(s => s.AllProvisioningHandlerTasks()).Returns(_tasks.Where(x => x.Handler == TaskHandlerNames.ProvisioningHandler));

            _mockUserIdentity = new Mock <IUserIdentity>();

            _mockHandlerOne = new Mock <ITaskHandler>();
            _mockHandlerOne.Setup(s => s.CanExecute(It.IsAny <Task>(), null)).Returns(true);

            _mockHandlerTwo   = new Mock <ITaskHandler>();
            _mockHandlerThree = new Mock <ITaskHandler>();

            _mockObjectBuilder = new Mock <IObjectBuilder>();
            _mockObjectBuilder.Setup(s => s.Resolve <ITaskHandler>(TaskHandlerNames.ProvisioningHandler))
            .Returns(_mockHandlerOne.Object);
            _mockObjectBuilder.Setup(s => s.Resolve <ITaskHandler>(TaskHandlerNames.OperationsHandler))
            .Returns(_mockHandlerTwo.Object);
            _mockObjectBuilder.Setup(s => s.Resolve <ITaskHandler>(TaskHandlerNames.SupportHandler))
            .Returns(_mockHandlerThree.Object);

            _mockLoggingManager = new Mock <ILoggingManager>();

            _provisioningHandlerManager = new ProvisioningHandlerManager(_mockTaskService.Object, _mockObjectBuilder.Object, _mockLoggingManager.Object);
        }
        public void TestInitialize()
        {
            _tasks = new List <Task>
            {
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.ProvisioningHandler;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.OperationsHandler;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.OperationsHandler;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.OperationsHandler;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.SupportHandler;
                })
            };

            _mockTaskService = new Mock <ITaskService>();
            _mockTaskService.Setup(s => s.AllSupportHandlerTasks()).Returns(_tasks.Where(x => x.Handler == TaskHandlerNames.SupportHandler));

            _mockHandlerOne   = new Mock <ITaskHandler>();
            _mockHandlerTwo   = new Mock <ITaskHandler>();
            _mockHandlerThree = new Mock <ITaskHandler>();

            _mockObjectBuilder = new Mock <IObjectBuilder>();
            _mockObjectBuilder.Setup(s => s.Resolve <ITaskHandler>(TaskHandlerNames.ProvisioningHandler))
            .Returns(_mockHandlerOne.Object);
            _mockObjectBuilder.Setup(s => s.Resolve <ITaskHandler>(TaskHandlerNames.OperationsHandler))
            .Returns(_mockHandlerTwo.Object);
            _mockObjectBuilder.Setup(s => s.Resolve <ITaskHandler>(TaskHandlerNames.SupportHandler))
            .Returns(_mockHandlerThree.Object);

            _mockLoggingManager = new Mock <ILoggingManager>();

            _supportHandlerManager = new SupportHandlerManager(_mockTaskService.Object, _mockObjectBuilder.Object, _mockLoggingManager.Object);
        }
Exemple #3
0
        public void TestInitialize()
        {
            _tasks = new List <Task>
            {
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.ProvisioningHandler;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler   = TaskHandlerNames.OperationsHandler;
                    task.Name      = OperationTaskType.AllocatePin.ToString();
                    task.Frequency = TaskFrequencyNames.OneTime;
                    task.Pin       = 12345;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler   = TaskHandlerNames.OperationsHandler;
                    task.Name      = OperationTaskType.AllocateCase.ToString();
                    task.Frequency = TaskFrequencyNames.OneTime;
                    task.Pin       = 67890;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler           = TaskHandlerNames.OperationsHandler;
                    task.Name              = OperationTaskType.UpdateCaseTitle.ToString();
                    task.CompletedDate     = DateTime.Now;
                    task.NextScheduledDate = DateTime.Now.AddDays(1);
                    task.Frequency         = TaskFrequencyNames.Daily;
                    task.Pin = 34567;
                }),
                UnitTestHelper.GenerateRandomData <Task>(task =>
                {
                    task.Handler = TaskHandlerNames.SupportHandler;
                })
            };

            _mockTaskService = new Mock <ITaskService>();
            _mockTaskService.Setup(s => s.AllOperationsHandlerTasks()).Returns(_tasks.Where(x => x.Handler == TaskHandlerNames.OperationsHandler));

            _mockUserIdentity = new Mock <IUserIdentity>();
            _mockUserIdentity.Setup(s => s.Name).Returns(UserName);

            _mockHistoryLogService = new Mock <IService <HistoryLog> >();

            _mockParameterService = new Mock <IParameterService>();

            _mockHandlerOne = new Mock <ITaskHandler>();
            _mockHandlerOne.Setup(s => s.CanExecute(It.IsAny <Task>(), It.IsAny <Guid>())).Returns(true);

            _mockObjectBuilder = new Mock <IObjectBuilder>();
            _mockObjectBuilder.Setup(s => s.Resolve <ITaskHandler>(TaskHandlerNames.OperationsHandler))
            .Returns(_mockHandlerOne.Object);

            _mockLoggingManager = new Mock <ILoggingManager>();

            _operationsHandlerManager = new OperationsHandlerManager(_mockTaskService.Object, _mockHistoryLogService.Object, _mockParameterService.Object, _mockObjectBuilder.Object, _mockLoggingManager.Object, _mockUserIdentity.Object);

            Fujitsu.AFC.Tasks.Properties.Settings.Default["ServiceInstanceId"] = _serviceInstanceId;

            Bootstrapper.Initialise();
        }