public void SetUp()
 {
     messenger = new Mock <IMvxMessenger>();
     repo      = new Mock <ICountersRepository>();      //In the test fixture setup, a new mock repository is creaed so that it's ready for each test
     service   = new CountersService(repo.Object,       //A new instance of the CountersService created using the mock object
                                     messenger.Object); //Passes the mock to the service constructor
 }
Exemple #2
0
        public PostPartHandler(IRepository<PostPartRecord> repository, 
            IPostService postService, 
            IClock clock,
            IReportPostService reportPostService,
            ICountersService countersService,
            ISubscriptionService subscriptionService

            ) {
            _postService = postService;
            _clock = clock;
            _reportPostService = reportPostService;
            _countersService = countersService;
            _subscriptionService = subscriptionService;

            Filters.Add(StorageFilter.For(repository));

            OnGetDisplayShape<PostPart>(SetModelProperties);
            OnGetEditorShape<PostPart>(SetModelProperties);
            OnUpdateEditorShape<PostPart>(SetModelProperties);

            OnCreated<PostPart>((context, part) => _countersService.UpdateCounters(part));

            OnPublished<PostPart>((context, part) => {
                _countersService.UpdateCounters(part);
                UpdateThreadVersioningDates(part);
                SendNewPostNotification(part);

                //for purposes of 'last read' need to know the last valid post to the thread.  The last time the user read the thread is tracked
                //and is compared to the lastest posts in the thread to determine if the thread has unread posts.
                if (!part.IsInappropriate)
                {
                    part.ThreadPart.LastestValidPostDate = part.As<CommonPart>().PublishedUtc.Value;
                }
            });
            OnUnpublished<PostPart>((context, part) => _countersService.UpdateCounters(part));
            OnVersioned<PostPart>((context, part, newVersionPart) => _countersService.UpdateCounters(newVersionPart));
            OnRemoved<PostPart>((context, part) =>
            {
                _countersService.UpdateCounters(part); 

                                                    //going to leave the history record for historic purposes
                                                    // RemoveReports(part); 
                                                    });

            OnRemoved<ThreadPart>((context, b) =>
                _postService.Delete(context.ContentItem.As<ThreadPart>()));

            
            OnIndexing<PostPart>((context, postPart) => context.DocumentIndex        
                                                    .Add("body", postPart.Record.Text).RemoveTags().Analyze()
                                                    .Add("format", postPart.Record.Format).Store()
                                                    .Add("forumsHomeId", postPart.ThreadPart.ForumPart.ForumCategoryPart.ForumsHomePagePart.Id)
                                                    .Add("categoryId", postPart.ThreadPart.ForumPart.ForumCategoryPart.Id)
                                                    .Add("forumId", postPart.ThreadPart.ForumPart.Id)
                                                    .Add("threadId", postPart.ThreadPart.Id)
                                                    );

            OnIndexing<ThreadPart>((context, threadPart) => context.DocumentIndex.Add("Title", threadPart.As<TitlePart>().Title ));
          
        }
 public void SetUp()
 {
     _service           = A.Fake <ICountersService> ();
     _messenger         = A.Fake <IMvxMessenger> ();
     _navigationService = A.Fake <IMvxNavigationService> ();
     _subject           = new CountersViewModel(_service, _messenger, _navigationService);
 }
 public ReportPostAdminController(
     IOrchardServices orchardServices,
     IForumService forumService,
     IThreadService threadService,
     IPostService postService,
     ISiteService siteService,
     IShapeFactory shapeFactory,
     IAuthorizationService authorizationService,
     IAuthenticationService authenticationService,
     ISubscriptionService subscriptionService,
     IReportPostService reportPostService,
     ICountersService countersService
     )
 {
     _orchardServices = orchardServices;
     _forumService = forumService;
     _threadService = threadService;
     _postService = postService;
     _siteService = siteService;
     _subscriptionService = subscriptionService;
     _authorizationService = authorizationService;
     _authenticationService = authenticationService;
     _reportPostService = reportPostService;
     _countersService = countersService;
     T = NullLocalizer.Instance;
     Shape = shapeFactory;
 }
Exemple #5
0
 public CountersViewModel(ICountersService service, IMvxMessenger messenger, IMvxNavigationService navigationService)
 {
     token                    = messenger.SubscribeOnMainThread <CountersChangedMessage> (async m => await LoadCounters());
     this.service             = service;
     Counters                 = new ObservableCollection <CounterViewModel>();
     this.navigationService   = navigationService;
     ShowAddNewCounterCommand = new MvxAsyncCommand(ShowAddNewCounter);
 }
Exemple #6
0
 public CountersViewModel(ICountersService service, IMvxNavigationService navigationService)
 {
     Console.WriteLine("Tatiana: inside CountersViewModel() constructor");
     this.service           = service;
     this.navigationService = navigationService;
     Counters = new ObservableCollection <CounterViewModel>();
     ShowAddNewCounterCommand = new MvxAsyncCommand(ShowAddNewCounter);
 }
 public CountersViewModel(ICountersService service,
                          IMvxMessenger messenger)
 {
     this.service = service;
     Counters     = new ObservableCollection <CounterViewModel>();
     token        = messenger.SubscribeOnMainThread <CountersChangedMessage>
                        (async m => await LoadCounters());
 }
Exemple #8
0
 public CounterViewModel(ICountersService service, IMvxNavigationService navigationService)
 {
     this.service           = service;
     this.navigationService = navigationService;
     DeleteCommand          = new MvxAsyncCommand(DeleteAccount);
     ShowCommand            = new MvxAsyncCommand(Show);
     CancelCommand          = new MvxAsyncCommand(Cancel);
     SaveCommand            = new MvxAsyncCommand(Save);
 }
Exemple #9
0
 public CounterViewModel(ICountersService service, INavigationService navigationService)
 {
     this.service           = service;
     this.navigationService = navigationService;
     IncrementCommand       = new RelayCommand(async() => await IncrementCounter());
     DeleteCommand          = new RelayCommand(async() => await DeleteCounter());
     CancelCommand          = new RelayCommand(Cancel);
     SaveCommand            = new RelayCommand(async() => await Save());
 }
Exemple #10
0
 public CounterViewModel(ICountersService service, IMvxNavigationService navigationService)
 {
     this.service           = service;
     this.navigationService = navigationService;
     IncrementCommand       = new MvxAsyncCommand(IncrementCounter);
     DeleteCommand          = new MvxAsyncCommand(DeleteCounter);
     CancelCommand          = new MvxAsyncCommand(Cancel);
     SaveCommand            = new MvxAsyncCommand(Save);
 }
 public CountersViewModel(ICountersService service, IMessenger messenger, INavigationService navigationService)
 {
     this.service           = service;
     this.navigationService = navigationService;
     messenger.Register <CountersChangedMessage>(this, async m => await LoadCounters());
     Counters = new ObservableCollection <CounterViewModel>();
     ShowAddNewCounterCommand = new RelayCommand(ShowAddNewCounter);
     LoadCounters();
 }
Exemple #12
0
        readonly IMvxNavigationService navigationService; //Injects and stores an instance of the MvvmCross navigation service

        public CountrViewModel(ICountersService service,  //The counters service is passed in as a constructor parameter and stored in the backing field
                               IMvxNavigationService navigationService)
        {
            this.service           = service;
            this.navigationService = navigationService;

            IncrementCommand = new MvxAsyncCommand(IncrementCounter); //Created a new MvxAsyncCommand wrapping a method
            DeleteCommand    = new MvxAsyncCommand(DeleteCounter);    //Creates a new MvxAsyncCommand for deleting counters

            CancelCommand = new MvxAsyncCommand(Cancel);
            SaveCommand   = new MvxAsyncCommand(Save);
        }
        public CountersViewModel(ICountersService service,
                                 IMvxMessenger messenger,                 //the messenger come from a construcot parameter
                                 IMvxNavigationService navigationService) //Injects and stores an instance of the MvvmCross navigation service
        {
            token = messenger
                    .SubscribeOnMainThread <CountersChangedMessage>
                        (async m => await LoadCounters()); //Subscribes to all CountersChangedMessage messages on the UI thread

            this.service = service;
            Counters     = new ObservableCollection <CountrViewModel>(); //The Counters property is an ObservableCollection of CounterViewModel

            this.navigationService   = navigationService;
            ShowAddNewCounterCommand = new MvxAsyncCommand(ShowAddNewCounter); //Creates the new command
        }
Exemple #14
0
 public PaymentService(IMapper mapper, IEmailService emailService, IUsersService usersService, ICookieService cookieService, IUploadImageService uploadImageService, IApplicationPricesService applicationPricesService, IBasketService basketService, IDefaultValuesService defaultValuesService, ICountersService countersService, HttpContext httpContext, IAgreementService agreementService)
 {
     _usersService             = usersService;
     _mapper                   = mapper;
     _emailService             = emailService;
     _cookieService            = cookieService;
     _uploadImageService       = uploadImageService;
     _applicationPricesService = applicationPricesService;
     _basketService            = basketService;
     _defaultValuesService     = defaultValuesService;
     _countersService          = countersService;
     _httpContext              = httpContext;
     _agreementService         = agreementService;
 }
Exemple #15
0
        public ThreadPartHandler(IRepository<ThreadPartRecord> repository, 
            IPostService postService,
            IThreadService threadService,
            IContentManager contentManager,
            ICountersService countersService,
            ISubscriptionService subscriptionService,
            IOrchardServices orchardServices
            
            ) {
            _postService = postService;
            _threadService = threadService;
            _contentManager = contentManager;
            _countersService = countersService;
            _subscriptionService = subscriptionService;
            _orchardServices = orchardServices;

            Filters.Add(StorageFilter.For(repository));

            OnGetDisplayShape<ThreadPart>(SetModelProperties);
            OnGetEditorShape<ThreadPart>(SetModelProperties);
            OnUpdateEditorShape<ThreadPart>(SetModelProperties);

            OnActivated<ThreadPart>(PropertyHandlers);
            OnLoading<ThreadPart>((context, part) => LazyLoadHandlers(part));

            OnCreated<ThreadPart>((context, part) => { 
                _countersService.UpdateForumPartCounters(part);
                //bit expensive but doesn't happen frequently
                part.ForumsHomepageId = part.ForumPart.ForumCategoryPart.ForumsHomePagePart.Id;   
            });

            OnPublished<ThreadPart>((context, part) => {
                _countersService.UpdateForumPartCounters(part);
                part.LastestValidPostDate = DateTime.UtcNow;
                //bit expensive but doesn't happen frequently
                part.ForumsHomepageId = part.ForumPart.ForumCategoryPart.ForumsHomePagePart.Id;              
            });

            OnUnpublished<ThreadPart>((context, part) => _countersService.UpdateForumPartCounters(part));
            OnVersioning<ThreadPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart));
            OnVersioned<ThreadPart>((context, part, newVersionPart) => _countersService.UpdateForumPartCounters(newVersionPart));
            OnRemoved<ThreadPart>((context, part) => OnThreadRemoved(context, part));
            
            OnRemoved<ForumPart>((context, b) =>
                _threadService.Delete(context.ContentItem.As<ForumPart>(), true));
        }
Exemple #16
0
 public CounterViewModel(ICountersService service)
 {
     this.service     = service;
     IncrementCommand = new MvxAsyncCommand(IncrementCounter);
     DeleteCommand    = new MvxAsyncCommand(DeleteCounter);
 }
Exemple #17
0
 public void SetUP()
 {
     repo      = new Mock <ICountersRepository>();
     messenger = new Mock <IMvxMessenger>();
     service   = new CountersService(repo.Object, messenger.Object);
 }
Exemple #18
0
 public void SetUp()
 {
     mockRepo      = new Mock <ICountersRepository>();
     mockMessenger = new Mock <IMvxMessenger>();
     service       = new CountersService(mockRepo.Object, mockMessenger.Object);
 }
 public void SetUp()
 {
     _repo      = A.Fake <ICounterRepository> ();
     _messenger = A.Fake <IMvxMessenger> ();
     _subject   = new CountersService(_repo, _messenger);
 }
 public ArticlesController(ILogger <ArticlesController> logger, IMessageSender messageSender, ICountersService countersService)
 {
     _logger          = logger;
     _messageSender   = messageSender;
     _countersService = countersService;
 }
 public void SetUP()
 {
     repository = new Mock <ICountersRepository>();
     service    = new CountersService(repository.Object);
 }
 public void MyTestInitialize()
 {
     messenger = new Mock <IMvxMessenger>();
     repo      = new Mock <ICountersRepository>();
     service   = new CounterService(repo.Object, messenger.Object);
 }
Exemple #23
0
 public CountersViewController(ICountersService counterService, IMessenger messenger)
 {
     this.counterService = counterService;
     this.messenger      = messenger;
 }