public void ParameterArgumentNullCheck()
        {
            // Arrange
            var sut = new GetUserByEmailHandler();

            // Act & Assert
            Assert.ThrowsAsync <ArgumentException>(() => sut.ExecuteAsync(null !));
        }
        public void InstantiateConstructor()
        {
            // Act
            var actual = new GetUserByEmailHandler();

            // Assert
            Assert.NotNull(actual);
        }
예제 #3
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());
        }
예제 #4
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);
        }