Exemplo n.º 1
0
        public void IsUserによるユーザの存在確認(string user, bool expected)
        {
            //exercise
            var actual = sut.IsUser(user);

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Exemplo n.º 2
0
        //�e�X�g�p logger��null�ł��
        public void Add(String name, String alias, Logger logger)
        {
            System.Diagnostics.Debug.Assert(logger != null, "logger != null");

            //alias�̕�����ɖ������Ȃ����ǂ�����m�F����
            var tmp = alias.Split(',');
            var sb  = new StringBuilder();

            foreach (var str in tmp)
            {
                if (str.IndexOf('@') != -1)
                {
                    //�O���[�o���A�h���X�̒lj�
                    sb.Append(str);
                    sb.Append(',');
                }
                else if (str.IndexOf('/') == 0)
                {
                    //���[�J���t�@�C���̏ꍇ
                    sb.Append(str);
                    sb.Append(',');
                }
                else if (str.IndexOf('$') == 0)
                {
                    //��`�̏ꍇ
                    if (str == "$ALL")
                    {
                        if (_mailBox != null)
                        {
                            foreach (string user in _mailBox.UserList)
                            {
                                sb.Append(string.Format("{0}@{1}", user, _domainList[0]));
                                sb.Append(',');
                            }
                        }
                    }
                    else if (str == "$USER")
                    {
                        //Ver5.4.3 $USER�lj�
                        sb.Append(string.Format("{0}@{1}", name, _domainList[0]));
                        sb.Append(',');
                    }
                    else
                    {
                        logger.Set(LogKind.Error, null, 45, string.Format("name:{0} alias:{1}", name, alias));
                    }
                }
                else
                {
                    if (_mailBox == null || !_mailBox.IsUser(str))
                    {
                        //���[�U���͗L�����H
                        logger.Set(LogKind.Error, null, 19, string.Format("name:{0} alias:{1}", name, alias));
                    }
                    else
                    {
                        sb.Append(string.Format("{0}@{1}", str, _domainList[0]));
                        sb.Append(',');
                    }
                }
            }
            string buffer;

            if (_ar.TryGetValue(name, out buffer))
            {
                logger.Set(LogKind.Error, null, 30, string.Format("user:{0} alias:{1}", name, alias));
            }
            else
            {
                _ar.Add(name, sb.ToString());
            }
        }