async Task AnswerRegularUser(SlackUser user)
        {
            await slackIntegration.SendDirectMessage(user, "Checking your profile");

            var verificationResult = await slackProfileValidator.ValidateProfile(user);

            if (verificationResult.IsValid)
            {
                await slackIntegration.SendDirectMessage(user,
                                                         $"Well done <@{user.Id}>, your profile is complete");
            }
            else
            {
                await slackIntegration.SendDirectMessage(user, verificationResult.Errors);
            }
        }
Пример #2
0
        public async Task VerifyProfile_CompleteProfile_Valid()
        {
            var user = CreateUser();

            user.Email     = "*****@*****.**";
            user.FirstName = "Runar";
            user.LastName  = "Hjerpbakk";
            user.WhatIDo   = "Software Engineering Manager";
            user.Image     = "http://image.jpg";
            faceDetectionClient.Setup(f => f.ValidateProfileImage(It.IsAny <SlackUser>())).ReturnsAsync(FaceDetectionResult.Valid);

            var validationResult = await slackProfileValidator.ValidateProfile(user);

            Assert.Equal(true, validationResult.IsValid);
            Assert.Same(user, validationResult.User);
            Assert.Equal("", validationResult.Errors);
            Assert.Null(validationResult.ImageURL);
        }
Пример #3
0
        public void VerifyProfile_SlackUserIsNull_Throws()
        {
            var exception = Record.Exception(() => slackProfileValidator.ValidateProfile(null));

            Assert.IsType <ArgumentNullException>(exception);
        }