示例#1
0
 public CheckIfPlayerIsAlreadyRegistered()
 {
     Test = activity => Please.Check(
         new IsUserRegistered(activity.From.Id, activity.Conversation.Id, activity.ServiceUrl));
     Positive = new CheckIfAnyChallengeIsInProgress();
     Negative = new WelcomeUser();
 }
示例#2
0
        /// <summary>
        /// The setup.
        /// </summary>
        public override void LocalSetup()
        {
            this.welcomeUser = new WelcomeUser {
                Host = "ab/.*", User = "******", Nick = ".*", Account = ".*", RealName = ".*"
            };
            this.ignoreUser = new WelcomeUser {
                Host = ".*", User = "******", Nick = ".*", Account = ".*", RealName = ".*", Exception = true
            };

            this.session = new Mock <ISession>();
        }
示例#3
0
        protected IEnumerable <CommandResponse> AddMode()
        {
            var exception = false;
            var opts      = new OptionSet
            {
                { "ignore", x => exception = true }
            };
            var extra = opts.Parse(this.Arguments);

            this.databaseSession.BeginTransaction(IsolationLevel.RepeatableRead);
            try
            {
                var welcomeUser = new WelcomeUser
                {
                    Nick      = ".*",
                    User      = "******",
                    Host      = string.Join(" ", extra),
                    Account   = ".*",
                    RealName  = ".*",
                    Channel   = this.CommandSource,
                    Exception = exception
                };

                this.databaseSession.Save(welcomeUser);
                this.databaseSession.Transaction.Commit();

                return(this.responder.Respond("common.done", this.CommandSource));
            }
            catch (Exception e)
            {
                this.Logger.Error("Error occurred during addition of welcome mask.", e);

                this.databaseSession.Transaction.Rollback();

                return(new[] { new CommandResponse {
                                   Message = e.Message
                               } });
            }
        }