コード例 #1
0
 public void InitTest()
 {
     _userService     = A.Fake <IUserService>();
     _eventAggregator = A.Fake <IEventAggregator>();
     _view            = A.Fake <IUsersListView>();
     _containter      = A.Fake <IUnityContainer>();
     _viewModel       = new UsersListViewModel(_userService, _eventAggregator, _view, _containter);
 }
コード例 #2
0
        public UsersListViewModel(IUserService userService, IEventAggregator eventAggregator, IUsersListView view,
                                  IUnityContainer container)
            : base(view)
        {
            if (userService == null)
            {
                throw new ArgumentNullException("userService");
            }
            _userService = userService;

            if (eventAggregator == null)
            {
                throw new ArgumentNullException("eventAggregator");
            }
            _eventAggregator = eventAggregator;

            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            _container = container;

            Title = "Users List";

            //rejestrujemy się na zdarzenie zapisania danych użytkownika, aby dodać nowego użytkownika
            //do listy uzytkowników
            _eventAggregator.GetEvent <SavedUserEvent>().Subscribe(ProcessSavedUserMessage);
        }