public MockServer(ServerSetup setup) : base(setup) { _serverData = MockServerData.GetInstance(); _serverData.Domains.Clear(); _serverData.Mailboxes.Clear(); _serverData.Groups.Clear(); _domainDal = new WebDomainDal(setup.Tenant); _mailboxDal = new MailboxDal(setup.Tenant, SetupInfo.Limits.MailboxMaxCountPerUser); _mailgroupDal = new MailGroupDal(setup.Tenant); _mailaddressDal = new MailAddressDal(setup.Tenant); var domains = _domainDal.GetTenantDomains(); foreach (var domain in domains) { _serverData.Domains.Add(new WebDomainBase(domain.name)); } var mailboxesDto = _mailboxDal.GetMailboxes(); foreach (var mailboxDto in mailboxesDto) { var aliasList = _mailaddressDal.GetMailboxAliases(mailboxDto.mailbox.id) .Select( aliasDto => new MailAddressBase(aliasDto.name, new WebDomainBase(aliasDto.domain.name))) .ToList(); var resultMailbox = new MailboxBase( new MailAccountBase(mailboxDto.mailbox.address), //Its not login. It adress. Needed only for testing new MailAddressBase(mailboxDto.mailbox_address.name, new WebDomainBase(mailboxDto.mailbox_address.domain.name)), aliasList); _serverData.Mailboxes.Add(resultMailbox); } var groupsDto = _mailgroupDal.GetMailGroups(); foreach (var resultGroup in from groupDto in groupsDto let groupAddresses = groupDto.addresses.Select(address => new MailAddressBase(address.name, new WebDomainBase ( address .domain .name))) .ToList() select new MailGroupBase( new MailAddressBase(groupDto.address.name, new WebDomainBase(groupDto.address.domain.name)), groupAddresses)) { _serverData.Groups.Add(resultGroup); } }
public MockServer(ServerSetup setup) : base(setup) { _serverData = MockServerData.GetInstance(); _serverData.Domains.Clear(); _serverData.Mailboxes.Clear(); _serverData.Groups.Clear(); _domainDal = new WebDomainDal(setup.Tenant); _mailboxDal = new MailboxDal(setup.Tenant, SetupInfo.Limits.MailboxMaxCountPerUser); _mailgroupDal = new MailGroupDal(setup.Tenant); _mailaddressDal = new MailAddressDal(setup.Tenant); var domains = _domainDal.GetTenantDomains(); foreach (var domain in domains) { _serverData.Domains.Add(new WebDomainBase(domain.name)); } var mailboxesDto = _mailboxDal.GetMailboxes(); foreach (var mailboxDto in mailboxesDto) { var aliasList = _mailaddressDal.GetMailboxAliases(mailboxDto.mailbox.id) .Select( aliasDto => new MailAddressBase(aliasDto.name, new WebDomainBase(aliasDto.domain.name))) .ToList(); var resultMailbox = new MailboxBase( new MailAccountBase(mailboxDto.mailbox.address), //Its not login. It adress. Needed only for testing new MailAddressBase(mailboxDto.mailbox_address.name, new WebDomainBase(mailboxDto.mailbox_address.domain.name)), aliasList); _serverData.Mailboxes.Add(resultMailbox); } var groupsDto = _mailgroupDal.GetMailGroups(); foreach (var resultGroup in from groupDto in groupsDto let groupAddresses = groupDto.addresses.Select(address => new MailAddressBase(address.name, new WebDomainBase ( address .domain .name))) .ToList() select new MailGroupBase( new MailAddressBase(groupDto.address.name, new WebDomainBase(groupDto.address.domain.name)), groupAddresses)) { _serverData.Groups.Add(resultGroup); } }
public static MockServerData GetInstance() { return(_instance ?? (_instance = new MockServerData())); }
public static MockServerData GetInstance() { return _instance ?? (_instance = new MockServerData()); }
public MockMailbox(int id, int tenant, IMailAddress address, IMailAccount account, List<IMailAddress> aliases, MailServerBase server) : base(id, tenant, address, account, aliases, server) { _serverData = MockServerData.GetInstance(); }
public MockMailGroup(int id, int tenant, IMailAddress address, List <IMailAddress> inAddresses, MailServerBase server) : base(id, tenant, address, inAddresses, server) { _serverData = MockServerData.GetInstance(); }
public MockMailbox(int id, int tenant, IMailAddress address, IMailAccount account, List <IMailAddress> aliases, MailServerBase server) : base(id, tenant, address, account, aliases, server) { _serverData = MockServerData.GetInstance(); }
public MockMailGroup(int id, int tenant, IMailAddress address, List<IMailAddress> inAddresses, MailServerBase server) : base(id, tenant, address, inAddresses, server) { _serverData = MockServerData.GetInstance(); }