Пример #1
0
        public void CreateNonExistingUser()
        {
            AddedUser = null;

            var newUser = new User()
            {
                Name   = "Michael Jackson",
                Amount = 10000M
            };

            userFacade.Create(newUser);
            Assert.IsTrue(new UserComparer().Equals(newUser, AddedUser));
        }
Пример #2
0
        public IScreen HandleInput(string input)
        {
            if (input == "q")
            {
                return(mainScreen.Value);
            }

            if (string.IsNullOrEmpty(input))
            {
                throw new InvalidInputException("Username can't be empty");
            }

            try
            {
                var newUser = new Domain.User()
                {
                    Name   = input,
                    Amount = DefaultUserBill
                };
                userFacade.Create(newUser);
                dataBus.SetData(Constants.DataKeys.User, newUser);
            }
            catch (ValidationException ex)
            {
                throw new InvalidInputException(ex.Message);
            }

            return(mainScreen.Value);
        }