示例#1
0
        static void Main(string[] args)
        {
            var emailResult = UnverifiedEmail.Create("*****@*****.**");


            emailResult.Match(
                Succ: email =>
            {
                SendResetPasswordLink(email);

                Console.WriteLine("Email address is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid email address. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );


            var replayResult = UnvalidateReplay.CreateBody("MyRespondForQuestion");


            replayResult.Match(
                Succ: replay =>
            {
                ReplayComplete(replay);
                Console.WriteLine("Replay address is valid.");
                return(Unit.Default);
            },
                Fail: ex =>
            {
                Console.WriteLine($"Invalid replay address. Reason: {ex.Message}");
                return(Unit.Default);
            }
                );


            Console.ReadLine();
        }
示例#2
0
        private static void ReplayComplete(UnvalidateReplay body)
        {
            var validateReplayResult = new VerifyReplayService().VerifyReplay(body);

            validateReplayResult.Match(
                validateReplay =>
            {
                new SendNotify(123, 4, "ReplayMessageForQuestion", "*****@*****.**", 156, "You have a new replay for question");
                new SendNotify(123, 4, "ReplayMessageForQuestion", "*****@*****.**", 156, "Your Replay has posted");
                new ReplayPublished(123, "ReplayMessageForQuestion");

                return(Unit.Default);
            },
                ex =>
            {
                new SendNotify(123, 4, "ReplayMessageForQuestion", "*****@*****.**", 156, "Your Replay cannot be posted. Try again using the help manual");

                Console.WriteLine(" Replay question could not be verified");
                return(Unit.Default);
            }
                );
        }
示例#3
0
 public Result <ValidateReplay> VerifyReplay(UnvalidateReplay body)
 {
     return(new ValidateReplay(body.Body));
 }