Exemplo n.º 1
0
        public void AddTest1()
        {
            //----------------------------------------------------------------------------------------------------
            //---only init the domain records which will force a cleaning of the address records
            InitDomainRecords();
            AddressManager mgr = CreateManager();

            //----------------------------------------------------------------------------------------------------
            //---make sure there are no mx records that exist
            Assert.Equal(0, mgr.Count());

            const long domainId    = 1;
            string     email       = BuildEmailAddress(1, 1);
            string     displayName = BuildEmailAddressDisplayName(1, 1);
            Address    addr        = new Address(domainId, email, displayName);

            using (CreateConfigDatabase())
            {
                mgr.Add(addr);
            }
            Assert.Equal(1, mgr.Count());
            addr = mgr.Get(email);
            Assert.Equal(domainId, addr.DomainID);
            Assert.Equal(email, addr.EmailAddress);
            Assert.Equal(displayName, addr.DisplayName);
            Assert.Equal(EntityStatus.New, addr.Status);
        }
Exemplo n.º 2
0
        public void AddTest()
        {
            InitDomainRecords();
            AddressManager mgr       = CreateManager();
            List <Address> addresses = new List <Address>();

            for (int i = 1; i <= MAXADDRESSCOUNT; i++)
            {
                addresses.Add(new Address(STARTID, BuildEmailAddress(STARTID, i)));
            }
            Assert.Equal(0, mgr.Count());
            mgr.Add(addresses);
            Assert.Equal(MAXADDRESSCOUNT, mgr.Count());
            Address[] aa = mgr.Get(string.Empty, MAXADDRESSCOUNT + 1).ToArray();
            Assert.Equal(MAXADDRESSCOUNT, aa.Length);
        }
Exemplo n.º 3
0
        public void CountTest()
        {
            InitAddressRecords();
            AddressManager mgr = CreateManager();

            Assert.Equal(MAXADDRESSCOUNT, mgr.Count(1));
        }
Exemplo n.º 4
0
        public void RemoveTest2()
        {
            InitAddressRecords();
            AddressManager mgr = CreateManager();

            string[] emailAddresses = new[] { BuildEmailAddress(1, 1), BuildEmailAddress(2, 1), BuildEmailAddress(3, 1) };
            Assert.Equal(emailAddresses.Length, mgr.Get(emailAddresses).Count());
            mgr.Remove(emailAddresses);
            Assert.Equal(0, mgr.Get(emailAddresses).Count());
            Assert.Equal(MAXADDRESSCOUNT * MAXDOMAINCOUNT - emailAddresses.Length, mgr.Count());
        }