public void LoadProfiles_NoSetProfiles_ShouldReturnEmptyProfilesEnumerable(Database db, [Content] Item item, ITracker tracker, IProfileProvider provider)
    {
      //arrange
      tracker.IsActive.Returns(true);

      var fakeSiteContext = new FakeSiteContext(new StringDictionary
      {
        {
          "rootPath", "/sitecore"
        },
        {
          "startItem", item.Paths.FullPath.Remove(0, "/sitecore".Length)
        }
      });
      fakeSiteContext.Database = db;

      using (new SiteContextSwitcher(fakeSiteContext))
      {
        using (new TrackerSwitcher(tracker))
        {
          var model = new VisitInformation(provider);
          model.LoadProfiles().Count().Should().Be(0);
        }
      }
    }
Exemple #2
0
        public void GetByNameTest()
        {
            IProfileProvider provider = factory.GetProfileProvider("provider1");

            Assert.IsNotNull(provider);
            Assert.IsTrue(provider is MockProfileProvider);
        }
        public AccountInfoViewModel(IProfileProvider profileProvider, ICredentialsProvider credentialsProvider, IDataCacheService dataCacheService, IFileCacheService fileCacheService, INavigationService navigationService,
            INotificationsProvider notificationsProvider, IBookmarksProvider bookmarksProvider, ICatalogProvider catalogProvider, IBookProvider bookProvider, ICatalitClient client, ILitresPurchaseService purchaseService)
        {
			_navigationService = navigationService;
			_profileProvider = profileProvider;
			_credentialsProvider = credentialsProvider;
			_dataCacheService = dataCacheService;
			_fileCacheService = fileCacheService;
			_notificationsProvider = notificationsProvider;
			_bookmarksProvider = bookmarksProvider;
			_catalogProvider = catalogProvider;
            _bookProvider = bookProvider;
            _client = client;
            _purchaseService = purchaseService;
            RegisterAction(ClearUserInfoPart).AddPart(ClearUserInfoProceed, session => true);
            RegisterAction(AddToDepositPart).AddPart(AddToDepositProceed, session => true);
            RegisterAction(LoadUserInfoPart).AddPart(LoadUserInfoProceed, session => session.Parameters.GetValue<UserInformation>(ChangeUserInfoParameter, null) == null);

            ClearData = new RelayCommand(ClearUserInfo);

            ReloadInfo = new RelayCommand(ReloadUserInfo);

            AddToDeposit = new RelayCommand<DepositType>(dt => AddToDepositFunc(dt));


            Deposits = new List<Deposit> { 
                                       new Deposit { LitresPrice = "105 руб.", RealPrice = "149 руб." }, 
                                       new Deposit { LitresPrice = "189 руб.", RealPrice = "269 руб." }, 
                                       new Deposit { LitresPrice = "304 руб.", RealPrice = "434 руб." }};
		}
 public ExperienceData(IContactProfileProvider contactProfileProvider, IProfileProvider profileProvider)
 {
     this.Visits         = new VisitsRepository(contactProfileProvider).Get();
     this.PersonalInfo   = new PersonalInfoRepository(contactProfileProvider).Get();
     this.OnsiteBehavior = new OnsiteBehaviorRepository(profileProvider).Get();
     this.Referral       = new ReferralRepository().Get();
 }
        public RegistrationViewModel(ICredentialsProvider credentialsProvider, IProfileProvider profileProvider, INavigationService navigationService, ICatalogProvider catalogProvider)
		{
			_credentialsProvider = credentialsProvider;
			_profileProvider = profileProvider;
            _catalogProvider = catalogProvider;
            RegisterAction(RegistrationPart).AddPart(session => RegistrationProceed(session), session => session.Parameters.GetValue<CatalitCredentials>(RegistrationParameter, null) != null);
		}
Exemple #6
0
 public ExperienceData(IContactProfileProvider contactProfileProvider, IProfileProvider profileProvider)
 {
     this.Visits = new VisitsRepository(contactProfileProvider).Get();
     this.PersonalInfo = new PersonalInfoRepository(contactProfileProvider).Get();
     this.OnsiteBehavior = new OnsiteBehaviorRepository(profileProvider).Get();
     this.Referral = new ReferralRepository().Get();
 }
Exemple #7
0
 public ProfileService(IProfileProvider profileProvider, UserManager <User, int> userManager, IImageService imageService, IMapper mapper)
 {
     _profileProvider = profileProvider ?? throw new ArgumentException(nameof(profileProvider));
     _userManager     = userManager ?? throw new ArgumentException(nameof(userManager));
     _imageService    = imageService ?? throw new ArgumentException(nameof(imageService));
     _mapper          = mapper ?? throw new ArgumentException(nameof(mapper));
 }
 protected ProfileCacheManagerBase(ILogger log, IProfileCache profileCache, IProfileProvider profileProvider)
     : base(log)
 {
     ProfileProvider = profileProvider;
     ProfileCache = profileCache;
     CounterMax = CounterMaxDefault;
     ProfileMaxCount = ProfileMaxCountDefault;
 }
Exemple #9
0
 public DcfStrategy(IIncomeStatementProvider incomeStatementProvider, IStocksRepository stocksRepository, IStockListService stockListService, IProfileProvider profileProvider, IBalanceSheetProvider balanceSheetProvider)
 {
     _incomeStatementProvider = incomeStatementProvider;
     _stocksRepository        = stocksRepository;
     _stockListService        = stockListService;
     _profileProvider         = profileProvider;
     _balanceSheetProvider    = balanceSheetProvider;
 }
Exemple #10
0
 private void InitTestObject()
 {
     _profileProvider = ProfileProviderMoqs.GetStandart();
     _userManager     = UserManagerMoqs.GetStandart();
     _imageService    = ImageServiceMoqs.GetStandart();
     _mapper          = IoContainer.Resolve <IMapper>();
     _testObject      = new ProfileService(_profileProvider, _userManager, _imageService, _mapper);
 }
 public void VisitDetails_TrackerInteractionNotInitialized_ShouldReturnNull(IContactProfileProvider contact, IProfileProvider profile, ITracker tracker)
 {
   //arrange
   var controller = new DemoController(contact, profile);
   using (new TrackerSwitcher(tracker))
   {
     controller.VisitDetails().Should().Be(null);
   }
 }
Exemple #12
0
 public ProfileController(
     IProfileProvider profileProvider,
     ProfileMapper profileMapper,
     ICurrentUserFactory userFactory)
     : base(userFactory)
 {
     _profileProvider = profileProvider;
     _profileMapper   = profileMapper;
 }
 public void ContactDetails_ContactInitialized_ShouldReturnContactInformation(IContactProfileProvider contact, IProfileProvider profile, ITracker tracker)
 {
   //arrange
   var controller = new DemoController(contact, profile);
   using (new TrackerSwitcher(tracker))
   {
     controller.ContactDetails().As<ViewResult>().Model.Should().BeOfType<ContactInformation>();
   }
 }
        public void EndVisit_ShouldEndSession(IContactProfileProvider contact, IProfileProvider profile, [Substitute] ControllerContext ctx)
        {
            //arrange
            var controller = new DemoController(contact, profile);

            controller.ControllerContext = ctx;
            controller.EndVisit();
            ctx.HttpContext.Session.Received(1).Abandon();
        }
        public void CreateFromFactory()
        {
            IProfileProvider dbProfile = ProfileFactory.GetProfileProvider("MyDbProfile1");

            dbProfile.SetProfile(this.ident, "test123");
            string result = dbProfile.GetProfile(this.ident).ToString();

            Assert.AreEqual("test123", result);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProfileService" /> class.
        /// </summary>
        /// <param name="profileProvider">The profile provider.</param>
        /// <param name="sessionStateService">The session state service.</param>
        /// <param name="profileRepository">The profile repository.</param>
        /// <param name="userRoleRepository">The user role repository.</param>
        public ProfileService(IProfileProvider profileProvider, ISessionStateService sessionStateService,
			IProfileRepository profileRepository, IUserRoleRepository userRoleRepository)
        {
            this.profileProvider = profileProvider;
            //this.logService = logService;
            this.sessionStateService = sessionStateService;
            this.profileRepository = profileRepository;
            this.userRoleRepository = userRoleRepository;
        }
        public LitresPurchaseService( ICatalogProvider catalogProvider, ICredentialsProvider credentialsProvider, IProfileProvider profileProvider, IInAppPurchaseService inAppPurchaseSevice, ICatalitClient client, IPurchaseServiceDecorator purchaseServiceDecorator, IDeviceInfoService deviceInfoService)
		{
			_inAppPurchaseService = inAppPurchaseSevice;
			_client = client;
			_catalogProvider = catalogProvider;
			_credentialsProvider = credentialsProvider;
			_profileProvider = profileProvider;
			_purchaseServiceDecorator = purchaseServiceDecorator;
			_deviceInfoService = deviceInfoService;
		}
        public virtual AutoMapperConfiguration WithProfileProvider([NotNull] IProfileProvider provider)
        {
            Check.NotNull(provider, nameof(provider));

            var clone = Clone();

            clone._provider = provider;

            return(clone);
        }
        public static IProfileProvider GetImplemented(TestInfo testInfo)
        {
            IProfileProvider provider = Substitute.For <IProfileProvider>();

            provider.Create(Arg.Any <UserProfile>());

            provider.GetProfileByUserId(Arg.Any <int>()).Returns(x => testInfo.Profiles.FirstOrDefault(i => i.Id == (int)x[0]));

            return(provider);
        }
Exemple #20
0
        public void SetUp()
        {
            _serviceEndpointsProvider = Substitute.For <IServiceEndpointsProvider>();

            _httpClient = Substitute.For <IHttpClient>();

            _requestBuilder = Substitute.For <IRequestBuilder>();

            _profileProvider = new GravatarProfileProvider(_serviceEndpointsProvider, _httpClient, _requestBuilder);
        }
		public ChangePasswordViewModel( IProfileProvider profileProvider, ICredentialsProvider credentialsProvider, INavigationService navigationService )
		{
			_navigationService = navigationService;
			_profileProvider = profileProvider;
			_credentialsProvider = credentialsProvider;

            RegisterAction(ChangePasswordPart).AddPart((session) => ChangePasswordProceed(session), (session) => session.Parameters.GetValue<UserInformation>(ChangePasswordParameter, null) != null);
            RegisterAction(LoadCredentialsPart).AddPart((session) => LoadCredentialsProceed(session), (session) => session.Parameters.GetValue<UserInformation>(ChangePasswordParameter, null) == null);
            RegisterAction(LoadUserInfoPart).AddPart((session) => LoadUserInfoProceed(session), (session) => session.Parameters.GetValue<UserInformation>(ChangePasswordParameter, null) == null);
		}
 public void ContactDetails_ContactNotInitialized_ShouldReturnNull(IContactProfileProvider contact, IProfileProvider profile, ITracker tracker)
 {
   tracker.Contact.Returns((Contact)null);
   //arrange
   var controller = new DemoController(contact, profile);
   using (new TrackerSwitcher(tracker))
   {
     controller.ContactDetails().Should().BeNull();
   }
 }
 public void VisitDetails_TrackerInitialized_ShouldReturnVisitInformation(IContactProfileProvider contact, IProfileProvider profile, ITracker tracker, CurrentInteraction interaction)
 {
   tracker.Interaction.Returns(interaction);
   //arrange
   var controller = new DemoController(contact, profile);
   using (new TrackerSwitcher(tracker))
   {
     controller.VisitDetails().As<ViewResult>().Model.Should().BeOfType<VisitInformation>();
   }
 }
Exemple #24
0
        public void GetDefaultTest()
        {
            IProfileProvider provider = factory.GetProfileProvider();

            Assert.IsNotNull(provider);
            Mock2ProfileProvider mockProvider =
                provider as Mock2ProfileProvider;

            Assert.IsNotNull(mockProvider);
            Assert.IsTrue(mockProvider.Initialized);
        }
        public ProfileViewModel(IProfileProvider profileProvider)
        {
            _profileProvider = profileProvider;
            Model            = _profileProvider.GetModel();

            TapCommand = new Command(() =>
            {
                //Model.Comment = "";
                //Model.Title = "Kommentaren er lagret";
                //Model.UserInfo
            });
        }
 public ActivityLogger(
     ILoggerProvider loggerProvider,
     IOptions <ActivityLoggerOptions> activityLoggerOptions,
     IProfileProvider profileProvider,
     IAccountProvider <TKeyType> accountProvider,
     ITenantProvider tenantProvider)
 {
     _logger          = ((LoggerProvider)loggerProvider).Logger;
     _activityLogType = activityLoggerOptions.Value.ActivityLogType ?? "DefaultType";
     _version         = activityLoggerOptions.Value.ActivityLogVersion ?? "1.0.0";
     _profileProvider = profileProvider;
     _accountProvider = accountProvider;
     _tenantProvider  = tenantProvider;
 }
    public void DemoContent_RenderingContextItemInitialized_ShouldReturnDemoContentView(Db db,IContactProfileProvider contact, IProfileProvider profile, ITracker tracker)
    {
      //arrange

      var itemID = ID.NewID;
      db.Add(new DbItem("ctx",itemID, Templates.DemoContent.ID));
      var controller = new DemoController(contact, profile);
      var context = new RenderingContext();
      context.ContextItem =  db.GetItem(itemID);
      ContextService.Get().Push(context);
      using (new TrackerSwitcher(tracker))
      {
        controller.DemoContent().As<ViewResult>().Model.Should().BeOfType<DemoContent>();
      }
    }
        private static IAzureContext GetDefaultContext(IProfileProvider provider, InvocationInfo invocationInfo)
        {
            IAzureContextContainer profile;
            var contextConverter = new AzureContextConverter();

            if (invocationInfo.BoundParameters.ContainsKey("DefaultContext") &&
                contextConverter.CanConvertFrom(invocationInfo.BoundParameters["DefaultContext"], typeof(IAzureContextContainer)))
            {
                profile = contextConverter.ConvertFrom(invocationInfo.BoundParameters["DefaultContext"], typeof(IAzureContextContainer), CultureInfo.InvariantCulture, true) as IAzureContextContainer;
            }
            else
            {
                profile = provider.Profile;
            }

            return(profile?.DefaultContext);
        }
		public AuthorizationViewModel( ICredentialsProvider credentialsProvider, IProfileProvider profileProvider, INavigationService navigationService, INotificationsProvider notificationsProvider,
			IDataCacheService dataCacheService, IFileCacheService fileCacheService, IBookmarksProvider bookmarksProvider, ICatalogProvider catalogProvider, IBookProvider bookProvider)
		{
			_credentialsProvider = credentialsProvider;
			_navigationService = navigationService;
			_profileProvider = profileProvider;
			_notificationsProvider = notificationsProvider;
			_dataCacheService = dataCacheService;
			_fileCacheService = fileCacheService;
			_bookmarksProvider = bookmarksProvider;
			_catalogProvider = catalogProvider;
		    _bookProvider = bookProvider;

            RegisterAction(MainPart).AddPart(LoadCredential, session => true);
            RegisterAction(LoginPart).AddPart(LoginProceed, session => true);

		}
Exemple #30
0
        public void CreateProfileTest()
        {
            TestInfo         testInfo = GetDefaultTestInfo();
            IProfileProvider profileProviderCustom = ProfileProviderMoqs.GetImplemented(testInfo);
            IProfileService  testObject            = new ProfileService(profileProviderCustom, _userManager, _imageService, _mapper);

            var profile = new ProfileDto()
            {
                Id       = 1,
                UserName = Guid.NewGuid().ToString(),
                FullName = Guid.NewGuid().ToString()
            };

            Assert.DoesNotThrow(() => testObject.CreateProfile(profile));

            profileProviderCustom.Received().Create(Arg.Any <UserProfile>());
        }
        static IAzureContext GetDefaultContext(IProfileProvider provider, System.Management.Automation.InvocationInfo invocationInfo)
        {
            IAzureContextContainer context;
            var contextConverter = new AzureContextConverter();

            if (invocationInfo.BoundParameters.ContainsKey("DefaultContext") &&
                contextConverter.CanConvertFrom(invocationInfo.BoundParameters["DefaultContext"], typeof(IAzureContextContainer)))
            {
                context = contextConverter.ConvertFrom(invocationInfo.BoundParameters["DefaultContext"], typeof(IAzureContextContainer), CultureInfo.InvariantCulture, true) as IAzureContextContainer;
            }
            else
            {
                context = provider.Profile;
            }

            return(context?.DefaultContext);
        }
Exemple #32
0
        public static MvcHtmlString DisplayProfileName <T>(this HtmlHelper <T> html, Guid profileId)
        {
            IProfileProvider ProfileProvider = Xyperico.Base.ObjectContainer.Container.Resolve <IProfileProvider>();

            Profile p = ProfileProvider.Get(profileId);

            string profileUrl = UrlHelper.GenerateUrl(
                "Profiles_Default", "show", "profile",
                new RouteValueDictionary(new { profilename = p.ProfileName }),
                html.RouteCollection,
                html.ViewContext.HttpContext.Request.RequestContext,
                true);

            string a = string.Format("<a href=\"{0}\">{1}</a>", profileUrl, p.FullName);

            return(MvcHtmlString.Create(a));
        }
Exemple #33
0
        public ReviewController(
            IMentorReviewProvider mentorReviewProvider,
            IMentorProvider mentorProvider,
            IProfileProvider profileProvider,
            IScrumReviewProvider scrumReviewProvider,
            ITraineeReviewProvider traineeReviewProvider,
            ProfileMapper profileMapper,
            ScrumReviewMapper scrumMasterMapper,
            MentorReviewMapper mentorReviewMapper,
            TraineeReviewMapper traineeReviewMapper)
        {
            _mentorReviewProvider  = mentorReviewProvider;
            _mentorProvider        = mentorProvider;
            _profileProvider       = profileProvider;
            _scrumReviewProvider   = scrumReviewProvider;
            _traineeReviewProvider = traineeReviewProvider;

            _profileMapper       = profileMapper;
            _scrumMasterMapper   = scrumMasterMapper;
            _mentorReviewMapper  = mentorReviewMapper;
            _traineeReviewMapper = traineeReviewMapper;
        }
        public ProfileViewModel(IMvxNavigationService navigation, IAccountProvider accountProvider, IProfileProvider profileProvider, IModalsService modalsService)
        {
            _accountProvider = accountProvider;
            _profileProvider = profileProvider;
            _modalsService   = modalsService;

            _navigation = navigation;

            Started = new MvxObservableCollection <CourseDTO>();
            Tasks   = new MvxObservableCollection <string>();

            ItemSelected = new MvxAsyncCommand <CourseWrapper>(OnClicked);
            RedeemCode   = new MvxAsyncCommand(OpenRedeemCode);

            Account = accountProvider.AccountInfo.AccountDTO;

            ChangePhoto = new MvxAsyncCommand(OpenImageCropper);

            UpdateProfile = new MvxAsyncCommand(ChangeProfile);

            Exit = new MvxAsyncCommand(ExitProgram);
        }
Exemple #35
0
        public void ExperienceData_InitializedTracker_ReturnExperienceData(
            IKeyBehaviorCache keyBehaviorCache,
            Session session,
            CurrentInteraction currentInteraction,
            ITracker tracker,
            [Frozen] IContactProfileProvider contactProfileProvider,
            [Frozen] IProfileProvider profileProvider,
            [Greedy] DemoController sut)
        {
            tracker.Interaction.Returns(currentInteraction);
            tracker.Session.Returns(session);
            var attachments = new Dictionary <string, object>()
            {
                ["KeyBehaviorCache"] = new Sitecore.Analytics.Tracking.KeyBehaviorCache(keyBehaviorCache)
            };

            tracker.Contact.Attachments.Returns(attachments);

            using (new TrackerSwitcher(tracker))
            {
                sut.ExperienceData().Should().BeOfType <ViewResult>().Which.Model.Should().BeOfType <ExperienceData>();
            }
        }
    public void LoadProfiles_SetProfiles_ShouldReturnExistentProfilesEnumerable([Content] Item item, PatternMatch patternMatch, ITracker tracker, IProfileProvider provider)
    {
      //arrange
      tracker.IsActive.Returns(true);

      var profileItem = item.Add("profile", new TemplateID(ProfileItem.TemplateID));
      using (new EditContext(profileItem))
      {
        profileItem.Fields[ProfileItem.FieldIDs.Type].Value = "Average";
        profileItem.Fields[ProfileItem.FieldIDs.NameField].Value = profileItem.Name;
      }

      provider.GetSiteProfiles().Returns(new[]{new ProfileItem(profileItem)});
      provider.HasMatchingPattern(null).ReturnsForAnyArgs(true);
      provider.GetPatternsWithGravityShare(null).ReturnsForAnyArgs(new [] { patternMatch });


      var fakeSiteContext = new FakeSiteContext("fake")
      {
        Database = item.Database
      };

      using (new SiteContextSwitcher(fakeSiteContext))
      {
        using (new TrackerSwitcher(tracker))
        {
          var model = new VisitInformation(provider);
          //act
          var profiles = model.LoadProfiles().ToArray();

          //assert
          profiles.Count().Should().Be(1);
          profiles.First().Name.Should().Be(profileItem.Name);
          profiles.First().PatternMatches.Single().Should().Be(patternMatch);
        }
      }
    }
 public void SelectProvider(object sender, ItemClickEventArgs e)
 {
     SelectedProvider = e.ClickedItem as IProfileProvider;
     Hide();
 }
    public void LoadProfiles_NoMatchingProfile_ShouldReturnEmptyProfilesEnumerable([Content] Item item, ITracker tracker, IProfileProvider provider)
    {
      //arrange
      tracker.IsActive.Returns(true);
      var profileItem = item.Add("profile", new TemplateID(ProfileItem.TemplateID));
      provider.GetSiteProfiles().Returns(new[]
      {
        new ProfileItem(profileItem)
      });
      provider.HasMatchingPattern(null).ReturnsForAnyArgs(false);


      using (new TrackerSwitcher(tracker))
      {
        var model = new VisitInformation(provider);
        //act
        var profiles = model.LoadProfiles().ToArray();

        //assert
        profiles.Length.Should().Be(0);
      }
    }
        public MainViewModel(
         //   IExpirationGuardian expirationGuardian, 
            IProfileProvider profileProvider, 
            IGenresProvider genresProvider, 
            ICatalogProvider catalogProvider, 
            ICredentialsProvider credentialsProvider,
            IBookProvider bookProvider,
            INavigationService navigationService, 
            INetworkAvailabilityService networkAvailability,
            IDeviceInfoService deviceInfoService, ILitresPurchaseService litresPurchaseService)
        {            
            _genresProvider = genresProvider;
			_catalogProvider = catalogProvider;
			_credentialsProvider = credentialsProvider;
			_profileProvider = profileProvider;
			_bookProvider = bookProvider;
			_navigationService = navigationService;
		//    _expirationGuardian = expirationGuardian;
		    _networkAvailability = networkAvailability;
            _deviceInfoService = deviceInfoService;
            _litresPurchaseService = litresPurchaseService;

            var deviceFamily = _deviceInfoService.DeviceFamily;
            if (!string.IsNullOrEmpty(deviceFamily) && deviceFamily.Equals("Windows.Desktop"))
            {
                _booksPerPage = 30;
            }
            ////MyBooks reload allways, may change account information
            RegisterAction(BuyBookPart).AddPart((session) => BuyBookAsync(session, Book), (session) => true);
            RegisterAction(GiftBookPart).AddPart((session) => GetGiftAsync(session, Book), (session) => true);
            RegisterAction(MyBooksPart).AddPart( LoadMyBooks, session => true);
            RegisterAction(BuyBookLitresPart).AddPart((session) => BuyBookFromLitres(session, Book), (session) => true);
            RegisterAction(CreditCardInfoPart).AddPart(session => CreditCardInfoAsync(session), (session) => true);
            RegisterAction(LoadMoreNoveltyBooksPart).AddPart(session => LoadNoveltyBooks(session), session => true);
            RegisterAction(LoadMorePopularBooksPart).AddPart(session => LoadPopularBooks(session), session => true);
            RegisterAction(LoadMoreInterestingBooksPart).AddPart(session => LoadInterestingBooks(session), session => true);
            RegisterAction(MyOffersPart).AddPart(LoadOffers, session => true);
            //RegisterPart(MyBooksPart, (session, part) => LoadMyBooks(session), (session, part) => true, false);
            ////RegisterPart(NewBooksPart, (session, part) => LoadNewBooks(session), (session, part) => true, false);

            MyBooksViewState = MyBooksViewStateEnum.Loading;

			Genres = new XCollection<Genre>();
			Banners = new XCollection<Banner>();

			_myBooks = new XCollection<Book>();
			_noveltyBooks = new XCollection<Book>();
			_popularBooks = new XCollection<Book>();
			_interestingBooks = new XCollection<Book>();

			MyBooks = new XSubRangeCollection<Book>(_myBooks, 0, 10);
            
            NoveltyBooks = new XCollection<Book>();
			PopularBooks = new XCollection<Book>();
			InterestingBooks = new XCollection<Book>();
			ShowMyBooks = new RelayCommand( ToMyBooks );
            BookSelected = new RelayCommand<Book>(book =>  _navigationService.Navigate("Book", XParameters.Create("BookEntity", book)), book => book != null);
            BuyBook = new RelayCommand<Book>(BuyBookFromLitresAsync);
            GiftBook = new RelayCommand<Book>(GiftBookFromLitresAsync);
            ShowInterestingBooks = new RelayCommand(() => _navigationService.Navigate("BooksByCategory", XParameters.Create("category", (int) BooksByCategoryViewModel.BooksViewModelTypeEnum.Interesting)));
			ShowPopularBooks = new RelayCommand(() => _navigationService.Navigate("BooksByCategory", XParameters.Create("category", (int) BooksByCategoryViewModel.BooksViewModelTypeEnum.Popular)));
			ShowNewBooks = new RelayCommand(() => _navigationService.Navigate("BooksByCategory", XParameters.Create("category", (int) BooksByCategoryViewModel.BooksViewModelTypeEnum.Novelty)));
            LoadMoreNoveltyBooks = new RelayCommand(LoadMoreNoveltyBooksProceed, () => true);
            LoadMorePopularBooks = new RelayCommand(LoadMorePopularBooksProceed, () => true);
            LoadMoreInterestingBooks = new RelayCommand(LoadMoreInterestingBooksProceed, () => true);
            GenreSelected = new RelayCommand<int>(ChooseGenre);
			ShowSearchHistory = new RelayCommand(() => _navigationService.Navigate("Search"));
            BuyBookFromMicrosoft = new RelayCommand(BuyBookFromMicrosoftAsync);
            Read = new RelayCommand<Book>(book =>
            {
                if (!book.IsExpiredBook)
                    _navigationService.Navigate("Reader", XParameters.Create("BookEntity", book), false);
                else new MessageDialog("Истёк срок выдачи.").ShowAsync();
            });

            ShowAuthorization = new RelayCommand(() => _navigationService.Navigate("Authorization"));
            ShowRegistration = new RelayCommand(() => _navigationService.Navigate("Registration"));
			ShowUserInfo = new RelayCommand( ToUserInfo );
            RunCreditCardPaymentProcess = new RelayCommand(CreditCardInfo);
           
            ShowAccountInfo = new RelayCommand(ToAccountInfo);
			ShowSettings = new RelayCommand(() => _navigationService.Navigate("Settings"));
			ShowBookmarks = new RelayCommand( () => _navigationService.Navigate( "Bookmarks" ) );
			ShowAbout = new RelayCommand( () => _navigationService.Navigate( "About" ) );
			ShowNotifications = new RelayCommand(() => _navigationService.Navigate("NotificationsEdit"));
            ShowCreditCardView = new RelayCommand<Book>(book => _navigationService.Navigate("CreditCardPurchase", XParameters.Create("BookEntity", book)), book => book != null);

            ShowAppSettings = new RelayCommand(ToAppSettings);

            //_expirationGuardian.StartGuardian();		    
        }
        public CatalogProvider(ICatalitClient client, IFileDownloadService fileDownloadService, IProfileProvider profileProvider, IBookProvider bookProvider, IDataCacheService dataCacheService, INetworkAvailabilityService networkAvailabilityService, IDeviceInfoService deviceInfoService)
		{
			_client = client;
			_dataCacheService = dataCacheService;
			_fileDownloadService = fileDownloadService;
			_bookProvider = bookProvider;
            _networkAvailabilityService = networkAvailabilityService;
			_myBooksIds = new List<int>();
			_myHistoryBooksIds = new List<int>();
            _profileProvider = profileProvider;
            _deviceInfoService = deviceInfoService;
            //_expirationGuardian = expirationGuardian;
		}
 public ProfileRepository(IProfileProvider profileProvider)
 {
     this._profileProvider = profileProvider;
 }
		public PersonViewModel(ICredentialsProvider credentialsProvider, IPersonsProvider personsProvider, ICatalogProvider catalogProvider, INavigationService navigationService, IRecensesProvider recensesProvider, INotificationsProvider notificationsProvider, ILitresPurchaseService litresPurchaseService, IProfileProvider profileProvider)
		{
			_credentialsProvider = credentialsProvider;
			_personsProvider = personsProvider;
			_catalogProvider = catalogProvider;
			_navigationService = navigationService;
			_recensesProvider = recensesProvider;
			_notificationsProvider = notificationsProvider;
		    _litresPurchaseService = litresPurchaseService;
		    _profileProvider = profileProvider;

		    PersonBooks = new XCollection<Book>();
			PersonRecenses = new XCollection<Recense>();

            RegisterAction(LoadMorePart).AddPart(session => LoadPersonBooks(session, Entity), session => true);
            RegisterAction(ChangeNotificationStatusPart).AddPart(session => ChangeNotificationStatus(session), session => true);
            RegisterAction(LoadMainPart).AddPart(session => LoadPerson(session), session => true);
            RegisterAction(AddPersonRecensePart).AddPart((session) => AddPersonRecense(session), (session) => true);
            RegisterAction(BuyBookLitresPart).AddPart((session) => BuyBookFromLitres(session, Book), (session) => true);
            RegisterAction(CreditCardInfoPart).AddPart(session => CreditCardInfoAsync(session), (session) => true);
            RegisterAction(BuyBookPart).AddPart((session) => BuyBookAsync(session, Book), (session) => true);

            LoadMoreCalled = new RelayCommand( () => LoadMore(), () => true );
			BookSelected = new RelayCommand<Book>( NavigateToBook, book => book != null );
			WriteRecenseSelected = new RelayCommand( () => _navigationService.Navigate( "AddRecense", XParameters.Create( "personId", Entity.Id ) ), () => Entity != null );
            BuyBook = new RelayCommand<Book>(book => BuyBookFromLitresAsync(book));
            RunCreditCardPaymentProcess = new RelayCommand(CreditCardInfo);
            ShowCreditCardView = new RelayCommand<Book>(book => _navigationService.Navigate("CreditCardPurchase", XParameters.Create("BookEntity", book)), book => book != null);
            BuyBookFromMicrosoft = new RelayCommand(BuyBookFromMicrosoftAsync);
            Read = new RelayCommand<Book>(book =>
            {
                if (!book.IsExpiredBook)
                    _navigationService.Navigate("Reader", XParameters.Create("BookEntity", book), false);
                else new MessageDialog("Истёк срок выдачи.").ShowAsync();
            });
        }
 public UserContactController(IProfileProvider profileProvider, Lazy <IAccessManager> accessManager)
     : base(accessManager)
 {
     ProfileProvider = profileProvider;
 }
        public SearchViewModel(ICatalogProvider catalogProvider, INavigationService navigationService, ILitresPurchaseService litresPurchaseService, ICredentialsProvider credentialsProvider, IProfileProvider profileProvider)
        {
            _catalogProvider = catalogProvider;
            _navigationService = navigationService;
            _litresPurchaseService = litresPurchaseService;
            _credentialsProvider = credentialsProvider;
            _profileProvider = profileProvider;

            FoundBooks = new XCollection<Book>();
            FoundPersons = new XCollection<Person>();
            FoundSequeses = new XCollection<Book.SequenceInfo>();
           
            FirstBooks = new XSubRangeCollection<Book>(FoundBooks, 0, 3);
            FirstPersons = new XSubRangeCollection<Person>(FoundPersons, 0, 3);
            FirstSequeces = new XSubRangeCollection<Book.SequenceInfo>(FoundSequeses, 0, 3);
            //FoundCollections = new XCollection<Book.CollectionsInfo>();
            //FirstCollections = new XSubRangeCollection<Book.CollectionsInfo>(FoundCollections, 0, 3);

            TagsAndGenresCollection = new List<object>(6);
            BestResult = new List<object>();

            RegisterAction(LoadAllDataPart).AddPart(SearchAll, session => true);
            RegisterAction(BuyBookLitresPart).AddPart((session) => BuyBookFromLitres(session, Book), (session) => true);
            RegisterAction(CreditCardInfoPart).AddPart(session => CreditCardInfoAsync(session), (session) => true);
            RegisterAction(BuyBookPart).AddPart((session) => BuyBookAsync(session, Book), (session) => true);

            BuyBook = new RelayCommand<Book>(book => BuyBookFromLitresAsync(book));
            RunCreditCardPaymentProcess = new RelayCommand(CreditCardInfo);
            ShowCreditCardView = new RelayCommand<Book>(book => _navigationService.Navigate("CreditCardPurchase", XParameters.Create("BookEntity", book)), book => book != null);
            BuyBookFromMicrosoft = new RelayCommand(BuyBookFromMicrosoftAsync);

            BookSelected = new RelayCommand<Book>(book => _navigationService.Navigate("Book", XParameters.Create("BookEntity", book)), book => book != null);
            PersonSelected = new RelayCommand<Person>(person => _navigationService.Navigate("Person", XParameters.Create("Id", person.Id)), person => person != null);
            GenreSelected = new RelayCommand<Genre>(genre => _navigationService.Navigate("BooksByCategory", XParameters.Empty.ToBuilder()
                .AddValue("category", 6)
                .AddValue("id", int.Parse(genre.id))
                .AddValue("title", genre.name)
                .ToImmutable()), genre => genre != null);
            TagSelected = new RelayCommand<Tag>(tag => _navigationService.Navigate("BooksByCategory", XParameters.Empty.ToBuilder()
                .AddValue("category", 5)
                .AddValue("id", int.Parse(tag.id))
                .AddValue("title", tag.name)
                .ToImmutable()), tag => tag != null);
            SequenceSelected = new RelayCommand<Book.SequenceInfo>(sequence => _navigationService.Navigate("BooksByCategory", XParameters.Empty.ToBuilder()
                .AddValue("category", 7)
                .AddValue("id", sequence.Id)
                .AddValue("title", sequence.Name)
                .ToImmutable()), sequence => sequence != null);
            Read = new RelayCommand<Book>(book =>
            {
                if (!book.IsExpiredBook)
                    _navigationService.Navigate("Reader", XParameters.Create("BookEntity", book), false);
                else new MessageDialog("Истёк срок выдачи.").ShowAsync();
            });

            //CollectionSelected = new RelayCommand<Book.SequenceInfo>(sequence => _navigationService.Navigate("BooksByCategory", XParameters.Empty.ToBuilder()
            //    .AddValue("category", 8)
            //    .AddValue("id", sequence.Id)
            //    .AddValue("title", sequence.Name)
            //    .ToImmutable()), sequence => sequence != null);

            LoadMoreFoundBooks = new RelayCommand(() => Load(new Session()));
        }
 public void EndVisit_ShouldReturnRedirectToRoot(IContactProfileProvider contact, IProfileProvider profile, [Substitute]ControllerContext ctx)
 {
   //arrange
   var controller = new DemoController(contact, profile);
   controller.ControllerContext = ctx;
   controller.EndVisit().As<RedirectResult>().Url.Should().Be("/");
 }
Exemple #46
0
 /// <summary>
 /// Instantiates a new instance of the <see cref="RunProfileTag"/> class
 /// </summary>
 public RunProfileTag()
 {
     this.profileProvider = new RealTimeProfileProvider(); // No DI = sadness
     this.Condition = "True"; // Default condition to true so that user does not need to specify
 }
        public void SetUp()
        {
            _decoratedProfileProvider = Substitute.For <IProfileProvider>();

            _exceptionHandlingProfileProvider = new ExceptionHandlingGravatarProfileProvider(_decoratedProfileProvider);
        }
 public void EndVisit_ShouldEndSession(IContactProfileProvider contact, IProfileProvider profile, [Substitute]ControllerContext ctx)
 {
   //arrange
   var controller = new DemoController(contact, profile);
   controller.ControllerContext = ctx;
   controller.EndVisit();
   ctx.HttpContext.Session.Received(1).Abandon();
 }
    public void DemoContent_RenderingContextItemNotInitialized_ShouldThrowException(IContactProfileProvider contact, IProfileProvider profile, ITracker tracker)
    {
      //arrange

      var controller = new DemoController(contact, profile);
      var context = new RenderingContext();
      ContextService.Get().Push(context);
      using (new TrackerSwitcher(tracker))
      {
        controller.Invoking(x => x.DemoContent()).ShouldThrow<InvalidDataSourceItemException>();
      }
    }
Exemple #50
0
 public ProfileRepository(IProfileProvider profileProvider)
 {
   this.profileProvider = profileProvider;
 }
 /// <summary>
 /// Initializa os dados do membership.
 /// </summary>
 private static void Initialize()
 {
     if (_initialized)
     {
         if (_initializeException != null)
         {
             throw _initializeException;
         }
     }
     else
     {
         if (_initializeException != null)
         {
             throw _initializeException;
         }
         lock (_initializeLock)
         {
             if (_initialized)
             {
                 if (_initializeException != null)
                 {
                     throw _initializeException;
                 }
             }
             else
             {
                 try
                 {
                     _providers = new List <IProfileProvider>();
                     ServiceLocatorValidator.Validate();
                     foreach (var provider in Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetAllInstances <IProfileProvider>())
                     {
                         _providers.Add(provider);
                     }
                     if (string.IsNullOrEmpty(DefaultProviderName))
                     {
                         _provider = _providers.FirstOrDefault();
                         if (_provider != null)
                         {
                             DefaultProviderName = _provider.Name;
                         }
                     }
                     else
                     {
                         _provider = _providers.Find(f => f.Name == DefaultProviderName);
                     }
                 }
                 catch (Exception exception)
                 {
                     _initializeException = exception;
                     throw;
                 }
                 if (_provider == null)
                 {
                     _initializeException = new InvalidOperationException(Properties.Resources.InvalidOperation_DefaultProfileProviderNotFound);
                     throw _initializeException;
                 }
                 _initialized = true;
             }
         }
     }
 }
Exemple #52
0
 public DemoController(IContactProfileProvider contactProfileProvider, IProfileProvider profileProvider)
 {
     this.contactProfileProvider = contactProfileProvider;
     this.profileProvider        = profileProvider;
 }
 public DraftTenderInfoController(IDraftProvider draftProvider, Lazy <IAccessManager> accessManager, IProfileProvider profileProvider)
     : base(accessManager)
 {
     DraftProvider   = draftProvider;
     ProfileProvider = profileProvider;
 }
 public void Setup()
 {
     this.ident = new GenericIdentity("testuser");
     this.profile = ProfileFactory.GetProfileProvider("MyDbProfile1") as DbProfileProvider;
     this.veryLongString = "testing123".PadLeft(10000, 'X');
 }
 public OnsiteBehaviorRepository(IProfileProvider profileProvider)
 {
   profileRepository = new ProfileRepository(profileProvider);
 }
Exemple #56
0
 public GetProfileFilterHandler(IProfileProvider ProfileProvider)
 {
     _profileProvider = ProfileProvider;
 }
 public VisitInformation(IProfileProvider profileProvider)
 {
   this.profileProvider = profileProvider;
 }
Exemple #58
0
 public OnsiteBehaviorRepository(IProfileProvider profileProvider)
 {
     this.profileRepository = new ProfileRepository(profileProvider);
 }
 public void DemoContent_RenderingContextNotDerivedFromSpecificTemplate_ShouldThrowException([Content]Item ctxItem, IContactProfileProvider contact, IProfileProvider profile, ITracker tracker)
 {
   //arrange
   var controller = new DemoController(contact, profile);
   var context = new RenderingContext();
   context.ContextItem = ctxItem;
   ContextService.Get().Push(context);
   using (new TrackerSwitcher(tracker))
   {
     controller.Invoking(x => x.DemoContent()).ShouldThrow<InvalidDataSourceItemException>();
   }
 }
Exemple #60
0
 public DemoController(IContactProfileProvider contactProfileProvider, IProfileProvider profileProvider)
 {
   this.contactProfileProvider = contactProfileProvider;
   this.profileProvider = profileProvider;
 }