Example #1
0
        public LifeCycleManager(IAuthenticationProvider authenticationProvider, String entityType)
        {
            Debug.WriteLine("Create new instance of LifeCycleManager for entityType '{0}'", entityType);
            _entityType = entityType;

            lock (_lock)
            {
                if (null == _staticStateMachineConfigLoader)
                {
                    LoadAndComposeParts();
                    _staticStateMachineConfigLoader = _stateMachineConfigLoader;
                    _staticCalloutExecutor          = _calloutExecutor;
                }
                else
                {
                    _stateMachineConfigLoader = _staticStateMachineConfigLoader;
                    _calloutExecutor          = _staticCalloutExecutor;
                }
            }
            _coreService = new CumulusCoreService.Core(new Uri(ConfigurationManager.AppSettings[CORE_ENDPOINT_URL_KEY]));
            _coreService.BuildingRequest += CoreServiceOnBuildingRequest;

            _entityController = new EntityController(authenticationProvider);
            _stateMachine     = new StateMachine.StateMachine();
            ConfigureStateMachine(entityType);
        }
        public LifeCycleManager(IAuthenticationProvider authenticationProvider, String entityType)
        {
            Debug.WriteLine("Create new instance of LifeCycleManager for entityType '{0}'", entityType);
            _entityType = entityType;

            lock (_lock)
            {
                if (null == _staticStateMachineConfigLoader)
                {
                    LoadAndComposeParts();
                    _staticStateMachineConfigLoader = _stateMachineConfigLoader;
                    _staticCalloutExecutor = _calloutExecutor;
                }
                else
                {
                    _stateMachineConfigLoader = _staticStateMachineConfigLoader;
                    _calloutExecutor = _staticCalloutExecutor;
                }
            }
            _coreService = new CumulusCoreService.Core(new Uri(ConfigurationManager.AppSettings[CORE_ENDPOINT_URL_KEY]));
            _coreService.BuildingRequest += CoreServiceOnBuildingRequest;

            _entityController = new EntityController(authenticationProvider);
            _stateMachine = new StateMachine.StateMachine();
            ConfigureStateMachine(entityType);
        }
        public void TestInitialize()
        {
            Mock.SetupStatic(typeof(CurrentUserDataProvider));
            Mock.SetupStatic(typeof(HttpContext));
            Mock.SetupStatic(typeof(CredentialCache));

            _stateMachineConfigLoader = Mock.Create <IStateMachineConfigLoader>();
            _authenticationProvider   = Mock.Create <IAuthenticationProvider>();
            _coreService      = Mock.Create <CumulusCoreService.Core>();
            _calloutExecutor  = Mock.Create <ICalloutExecutor>();
            _entityController = Mock.Create <EntityController>();
            _windowsIdentity  = Mock.Create <WindowsIdentity>();

            var hashGenerator = Mock.Create <SHA256>();

            Mock.Arrange(() => hashGenerator.ComputeHash(Arg.IsAny <byte[]>()))
            .IgnoreInstance()
            .Returns(StringToByteArray(SAMPLE_TOKEN));
        }
        public void TestInitialize()
        {
            Mock.SetupStatic(typeof(CurrentUserDataProvider));
            Mock.SetupStatic(typeof(HttpContext));
            Mock.SetupStatic(typeof(CredentialCache));

            _stateMachineConfigLoader = Mock.Create<IStateMachineConfigLoader>();
            _authenticationProvider = Mock.Create<IAuthenticationProvider>();
            _coreService = Mock.Create<CumulusCoreService.Core>();
            _calloutExecutor = Mock.Create<ICalloutExecutor>();
            _entityController = Mock.Create<EntityController>();
            _windowsIdentity = Mock.Create<WindowsIdentity>();

            var hashGenerator = Mock.Create<SHA256>();
            Mock.Arrange(() => hashGenerator.ComputeHash(Arg.IsAny<byte[]>()))
                .IgnoreInstance()
                .Returns(StringToByteArray(SAMPLE_TOKEN));
        }