示例#1
0
 protected T CreateTestControllerWith <T>(
     UserValidationLogic userValidationLogic = null,
     UserServicesLogic userServicesLogic     = null,
     UserVASLogic userVasLogic = null,
     TeliaTvLogic teliaTvLogic = null,
     UserValueAddedServiceStatusLogic userVasStatusLogic = null,
     SubscriptionVasLogic subscriptionVasLogic           = null,
     IUserManager userManager = null,
     IHateoasHandlerFactory hateoasHandlerFactory = null
     ) where T : ApiController, new()
 {
     _userValidationLogic   = userValidationLogic ?? _userValidationLogic;
     _userServicesLogic     = userServicesLogic ?? _userServicesLogic;
     _userVasLogic          = userVasLogic ?? _userVasLogic;
     _teliaTvLogic          = teliaTvLogic ?? _teliaTvLogic;
     _userVasStatusLogic    = userVasStatusLogic ?? _userVasStatusLogic;
     _subscriptionVasLogic  = subscriptionVasLogic ?? _subscriptionVasLogic;
     _userManager           = userManager ?? _userManager;
     _hateoasHandlerFactory = hateoasHandlerFactory ?? _hateoasHandlerFactory;
     return(new ValueAddedServicesController(
                _userValidationLogic,
                _userServicesLogic,
                _userVasLogic,
                _teliaTvLogic,
                _userVasStatusLogic,
                _subscriptionVasLogic,
                _userManager,
                _hateoasHandlerFactory
                ) as T);
 }
示例#2
0
        public void SetUp()
        {
            _userValidationLogic   = GetInst <UserValidationLogic> ();
            _userServicesLogic     = GetInst <UserServicesLogic> ();
            _userVasLogic          = GetInst <UserVASLogic> ();
            _teliaTvLogic          = GetInst <TeliaTvLogic> ();
            _userVasStatusLogic    = GetInst <UserValueAddedServiceStatusLogic> ();
            _subscriptionVasLogic  = GetInst <SubscriptionVasLogic> ();
            _hateoasHandlerFactory = GetInst <IHateoasHandlerFactory> ();
            _userManager           = GetInst <IUserManager> ();

            base.Setup();
        }
        public new void Setup()
        {
            base.Setup();

            _topUpLogic = GetInst <ITopUpLogic>();

            _userManager         = GetInst <IUserManager>();
            _usageLogic          = GetInst <IUsageLogic>();
            _userValidationLogic = GetInst <UserValidationLogic>();

            _accessRightLogic = GetInst <IAccessRightLogic>();

            _subscriptionService       = GetInst <ISubscriptionService>();
            _subscriptionLogic         = GetInst <ISubscriptionLogic>();
            _subscriptionVasLogic      = GetInst <SubscriptionVasLogic>();
            _subscriptionStatusLogic   = GetInst <ISubscriptionStatusLogic>();
            _changeSubscriptionLogic   = GetInst <IChangeSubscriptionLogic>();
            _subscriptionOfferingLogic = GetInst <ISubscriptionOfferingLogic>();

            _appSettings    = GetInst <IApplicationSettings>();
            _catalogService = GetInst <ICatalogService>();

            _cbmService    = GetInst <ICbmService>();
            _orderSimLogic = GetInst <IOrderSimLogic>();
            _accountLogic  = GetInst <IAccountLogic>();

            dict = new Dictionary <Params, object>()
            {
                { Params.TopUp, _topUpLogic },
                { Params.UserManager, _userManager },
                { Params.Usage, _usageLogic },
                { Params.UserValidation, _userValidationLogic },
                { Params.AccessRights, _accessRightLogic },
                { Params.SubscriptionService, _subscriptionService },
                { Params.Subscription, _subscriptionLogic },
                { Params.SubscriptionVas, _subscriptionVasLogic },
                { Params.SubscriptionStatus, _subscriptionStatusLogic },
                { Params.ChangeSubscription, _changeSubscriptionLogic },
                { Params.SubscriptionOffering, _subscriptionOfferingLogic },
                { Params.AppSettings, _appSettings },
                { Params.CatalogService, _catalogService },
                { Params.CbmService, _cbmService },
                { Params.OrderSim, _orderSimLogic },
                { Params.Account, _accountLogic }
            };
        }
示例#4
0
 /// <summary>
 /// Allows fine grained control over how the controller is instantiated for a particular test
 /// Each of the optional arguments lets you override the default mock that will be used if arg not passed
 /// </summary>
 /// <param name="subscriptionVas"></param>
 /// <param name="userValidation"></param>
 /// <param name="subscriptionService"></param>
 /// <param name="subscription"></param>
 /// <param name="orderSim"></param>
 /// <param name="subscriptionStatus"></param>
 /// <param name="subscriptionOffering"></param>
 /// <param name="changeSubscription"></param>
 /// <param name="userManager"></param>
 /// <param name="catalogService"></param>
 /// <param name="account"></param>
 /// <returns></returns>
 public SubscriptionController CreateTestController(
     SubscriptionVasLogic subscriptionVas     = null,
     UserValidationLogic userValidation       = null,
     ISubscriptionService subscriptionService = null,
     ISubscriptionLogic subscription          = null,
     IOrderSimLogic orderSim = null,
     ISubscriptionStatusLogic subscriptionStatus     = null,
     ISubscriptionOfferingLogic subscriptionOffering = null,
     IChangeSubscriptionLogic changeSubscription     = null,
     IUserManager userManager       = null,
     ICatalogService catalogService = null,
     IAccountLogic account          = null
     )
 {
     subscriptionVas      = Eval <SubscriptionVasLogic>(Params.SubscriptionVas, subscriptionVas);
     userValidation       = Eval <UserValidationLogic>(Params.UserValidation, userValidation);
     subscriptionService  = Eval <ISubscriptionService>(Params.SubscriptionService, subscriptionService);
     subscription         = Eval <ISubscriptionLogic>(Params.Subscription, subscription);
     orderSim             = Eval <IOrderSimLogic>(Params.OrderSim, orderSim);
     subscriptionStatus   = Eval <ISubscriptionStatusLogic>(Params.SubscriptionStatus, subscriptionStatus);
     subscriptionOffering = Eval <ISubscriptionOfferingLogic>(Params.SubscriptionOffering, subscriptionOffering);
     changeSubscription   = Eval <IChangeSubscriptionLogic>(Params.ChangeSubscription, changeSubscription);
     userManager          = Eval <IUserManager>(Params.UserManager, userManager);
     catalogService       = Eval <ICatalogService>(Params.CatalogService, catalogService);
     account = Eval <IAccountLogic>(Params.Account, account);
     return(new SubscriptionController(
                subscriptionVas,
                userValidation,
                subscriptionService,
                subscription,
                orderSim,
                subscriptionStatus,
                subscriptionOffering,
                changeSubscription,
                userManager,
                catalogService,
                account
                ));
 }