Exemplo n.º 1
0
        public void Get_all_messages_of_user()
        {
            var test = new List<User>()
                       {
                           new User()
                           {
                               Name = "Alice",
                               _messages = new List<Message>()
                                           {
                                               new Message()
                                               {
                                                   UsersMessage = "test"
                                               }
                                           }
                           }
                       };
            _userList = new UserList();
            _userList.ListOfUsers = test;

            _sut = new Reading(_userList);
            var messageList = _sut.GetMessages("Alice");
            var firstMessage = messageList.FirstOrDefault();

            Assert.AreEqual(firstMessage.UsersMessage, "test");
        }
Exemplo n.º 2
0
 public CommandHandler(IUserList userList, IPublish publish, IReading reading, IFollow follow, IWall wall)
 {
     _userList = userList;
     _publish = publish;
     _reading = reading;
     _follow = follow;
     _wall = wall;
 }
Exemplo n.º 3
0
 public UsersController(IUserList userList, ICommand <UserAddEditModel> command, IQueryWithParameters <UserAddEditModel, UserByIdParameter> userGetQuery,
                        ICommand <int> deleteCommand, IQueryWithParameters <QueryResult <UserListPaginationModel>, UserListParameter> userListQuery)
 {
     _userList      = userList;
     _command       = command;
     _userGetQuery  = userGetQuery;
     _deleteCommand = deleteCommand;
     _userListQuery = userListQuery;
 }
Exemplo n.º 4
0
        public void Add_user_to_list()
        {
            string username = "******";
            _sut = new UserList();

            _sut.AddUser(username);
            var countOfUsers = _sut.CountOfUsers();
            Assert.AreEqual(2, countOfUsers);
        }
Exemplo n.º 5
0
        public Ctrl_User(Ctrl_UserList ctrl_UserList)
        {
            InitializeComponent();
            userList = ctrl_UserList;
            Tag      = new UserPresenter(userList, this);

            btnUpdate.Click += (s, a) => OnUpdateClick();
            btnCreate.Click += (s, a) => OnCreateClick();
            btnSave.Click   += (s, a) => OnSaveClick();
            btnDelete.Click += (s, a) => OnDeleteClick();
        }
Exemplo n.º 6
0
        public void Must_be_able_to_publish_a_message()
        {
            _userList = new UserList();
            _userList.AddUser("Alice");
            _sut = new Publish(_userList);

            _sut.PublishMessage(usersMessage, "Alice");

            var user = _userList.GetUser("Alice");
            Assert.AreEqual(user._messages.Count, 1);
        }
Exemplo n.º 7
0
        public Form1()
        {
            InitializeComponent();

            IUser     model    = new UserProxy();
            IUserList viewList = this.userList1;

            _facade.Presenters.Add(new UserListPresenter(model, viewList));

            IUserAdd viewAdd = this.userAdd1;

            _facade.Presenters.Add(new UserAddPresenter(model, viewAdd));
        }
Exemplo n.º 8
0
        public UserPresenter(IUserList userListView, IUser userView)
        {
            this.userService  = new UserService();
            this.userListView = userListView;
            this.userView     = userView;

            userListView.Load             += ViewOnLoad;
            userListView.DoubleClickEvent += OnDoubleClick;
            userView.OnUpdateClickEvent   += OnUpdateClick;
            userView.OnCreateClickEvent   += OnCreateClick;
            userView.OnSaveClickEvent     += OnSaveClick;
            userView.OnDeleteClickEvent   += OnDeleteClick;
        }
Exemplo n.º 9
0
        public void Get_user_from_list()
        {
            var expectedUser = new User()
                               {
                                   Name = "Alice",
                                   _messages = new List<Message>()
                               };

            string username = "******";
            _sut = new UserList();

            _sut.AddUser(username);
            var user = _sut.GetUser(username);
            Assert.AreEqual(expectedUser.Name, user.Name);
        }
Exemplo n.º 10
0
        public void Must_display_all_messages_in_wall()
        {
            var test = new List<User>()
                       {
                           new User()
                           {
                               Name = "Alice",
                               _messages = new List<Message>()
                                           {
                                               new Message()
                                               {
                                                   UsersMessage = "test1"
                                               }
                                           },
                               _peopleFollowing = new List<User>()
                                                  {
                                                      new User()
                                                      {
                                                          _messages = new List<Message>()
                                                                      {
                                                                          new Message()
                                                                          {
                                                                              UsersMessage = "test"
                                                                          }
                                                                      }
                                                      }
                                                  }
                           }
                       };
            _userList = new UserList();
            _userList.ListOfUsers = test;
            var username = "******";

            _sut = new Wall(_userList);

            var listOfMessages = _sut.DisplayAllMessages(username);

            Assert.AreEqual(listOfMessages.Count, 2);
        }
Exemplo n.º 11
0
        public void Must_be_able_to_follow_another_user()
        {
            var test = new List<User>()
                       {
                           new User()
                           {
                               Name = "Alice",
                               _peopleFollowing = new List<User>()
                           }
                       };
            _userList = new UserList();
            _userList.ListOfUsers = test;

            var username = "******";
            var usernameOfFollowed = "Bob";

            _sut = new Follow(_userList);

            _sut.FollowUser(username, usernameOfFollowed);

            var user = test.Find(u => u.Name == username);
            Assert.AreEqual(user._peopleFollowing.Count, 1);
        }
Exemplo n.º 12
0
 public Reading(IUserList userList)
 {
     _userList = userList;
 }
Exemplo n.º 13
0
 public UserListPresenter(IUser model, IUserList view)
 {
     this._model = model;
     this._view  = view;
     WireUpViewEvents();
 }
Exemplo n.º 14
0
 public Publish(IUserList userList)
 {
     _userList = userList;
 }
Exemplo n.º 15
0
 public LoginForm()
 {
     InitializeComponent();
     ul = (IUserList)RemoteNew.New(typeof(IUserList));
 }
Exemplo n.º 16
0
 public SUT(IUserList userList)
 {
     this.UserList = userList;
 }
Exemplo n.º 17
0
 public SimpleUserService(IUserList userList)
 {
     _userList = userList ?? throw new ArgumentNullException(nameof(userList));
 }
Exemplo n.º 18
0
 public Follow(IUserList userList)
 {
     _userList = userList;
 }
 public UserListPresenter(IUserList param)
 {
     view = param;
 }
Exemplo n.º 20
0
 public Wall(IUserList userList)
 {
     _userList = userList;
 }