Esempio n. 1
0
        public async Task TestRequestInvalidParam()
        {
            GetUserByEmail getUserByEmail = new GetUserByEmail();

            getUserByEmail.Email = "";

            CQ.GetUserByEmailValidator validator = new CQ.GetUserByEmailValidator();

            GetUserByEmailHandler getUserByEmailHandler = new GetUserByEmailHandler(validator, new UserRepo());
            var getresult = await getUserByEmailHandler.Handle(getUserByEmail, new CancellationToken());
        }
Esempio n. 2
0
        public async Task TestAddValidUser()
        {
            U.User user = new U.User
            {
                Name     = "test",
                LastName = "test",
                EMail    = "*****@*****.**",
                Id       = 1,
                Password = "******",
                Phone    = "1234567890",
                UserName = "******"
            };

            UserValidator userValidator = new UserValidator(userRepo);


            CreateUserCommand createUserCommand = new CreateUserCommand();

            createUserCommand.Item = user;

            CreateUserCommandHandler createUserCommandHandler = new CreateUserCommandHandler(userValidator, userRepo);

            var addresult = await createUserCommandHandler.Handle(createUserCommand, new CancellationToken());

            GetUserByEmail getUserByEmail = new GetUserByEmail();

            getUserByEmail.Email    = user.EMail;
            getUserByEmail.Password = user.Password;

            CQ.GetUserByEmailValidator validator = new CQ.GetUserByEmailValidator();

            GetUserByEmailHandler getUserByEmailHandler = new GetUserByEmailHandler(validator, userRepo);
            var getresult = await getUserByEmailHandler.Handle(getUserByEmail, new CancellationToken());

            Assert.AreEqual(getresult.EMail, user.EMail);
        }