예제 #1
0
 public void CreateDomainManager()
 {
     var context = new ServiceContext();
     _domainManager = new DomainManager();
     context.Add(_domainManager);
     context.ServiceManager.StartServices();
 }
예제 #2
0
        public ConfigStore(string connectString, TimeSpan timeout)
        {
            if (string.IsNullOrEmpty(connectString))
            {
                throw new ArgumentException("connectString");
            }
            if (timeout.Ticks <= 0)
            {
                throw new ArgumentException("timeout");
            }

            m_timeout = timeout;
            m_connectString = connectString;
            m_domains = new DomainManager(this);
            m_addresses = new AddressManager(this);
            m_certificates = new CertificateManager(this);
            m_anchors = new AnchorManager(this);
            m_dnsRecords = new DnsRecordManager(this);
            m_administrators = new AdministratorManager(this);
            m_properties = new PropertyManager(this);
            m_blobs = new NamedBlobManager(this);
            m_Mdns = new MdnManager(this);
            m_bundles = new BundleManager(this);
            m_certPolicies = new CertPolicyManager(this, new CertPolicyParseValidator());
            m_certPolicyGroups = new CertPolicyGroupManager(this);
        }
        public void UnloadUnloadedDomain()
        {
            AppDomain domain = AppDomain.CreateDomain("DomainManagerTests-domain");
            AppDomain.Unload(domain);

            DomainManager manager = new DomainManager();
            manager.Unload(domain);
        }
예제 #4
0
        public void CreateDomainManagerAndDomain()
        {
            var context = new ServiceContext();
            _domainManager = new DomainManager();
            context.Add(_domainManager);
            context.ServiceManager.StartServices();

            _domain = _domainManager.CreateDomain(new TestPackage(MockAssembly.AssemblyPath));
        }
예제 #5
0
        public static int Execute(string[] argv, FrameworkName targetFramework, DomainManager.ApplicationMainInfo info)
        {
            var bootstrapperContext = GetBootstrapperContext(targetFramework, info);
            var bootstrapperType = bootstrapperContext.GetType().Assembly.GetType("Microsoft.Dnx.Host.RuntimeBootstrapper");

            var executeMethodInfo = bootstrapperType.GetMethod("Execute", BindingFlags.Static | BindingFlags.Public, null,
                    new[] { typeof(string[]), bootstrapperContext.GetType() }, null);

            return (int)executeMethodInfo.Invoke(null, new object[] { argv, bootstrapperContext });
        }
예제 #6
0
        public void RemoveTest()
        {
            InitDomainRecords();
            DomainManager target = CreateManager();
            string        name   = BuildDomainName(GetRndDomainID());

            Assert.NotNull(target.Get(name));
            using (ConfigDatabase db = CreateConfigDatabase())
            {
                target.Remove(name);
                db.SubmitChanges();
            }
            Assert.Null(target.Get(name));
        }
예제 #7
0
        private void LoadDefaultData()
        {
            IList <Category> lst = DomainManager.GetAll <Category>();

            if (lst != null)
            {
                ddlCategories.DataSource     = lst;
                ddlCategories.DataTextField  = "CategoryName";
                ddlCategories.DataValueField = "Id";
                ddlCategories.DataBind();
            }

            txtTitle.Attributes.Add("onblur", string.Format("AutoGenerateAlias(this.value, '{0}', false);", txtAlias.ClientID));
        }
예제 #8
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            string email = txtEmail.Text.Trim();
            User   user  = TNHelper.GetUserByEmail(email);

            if (user == null)
            {
                Utils.ShowMessage(lblMsg, "Địa chỉ email không tồn tại.");
            }
            else if (user != null && !user.Active)
            {
                Utils.ShowMessage(lblMsg, "Tài khoản của bạn chưa được kích hoạt. Hãy kích hoạt tài của bạn trước khi gởi yêu cầu mật khẩu mới.");
            }
            else
            {
                user = DomainManager.GetObject <User>(user.Id);
                if (user != null)
                {
                    string newpass = Utils.GetNewPassword();
                    string oldpass = user.Password;
                    user.Password = newpass;

                    string from    = TNHelper.GetSettings().DefaultSender;
                    string to      = user.Email;
                    string subject = TNHelper.GetSettings().ResetEmailSubject;
                    subject = Utils.ResolveMessage(subject, user);

                    string content = TNHelper.GetSettings().ResetEmailTemplate;
                    content = Utils.ResolveMessage(content, user);

                    if (Utils.SendEmail(from, to, subject, content))
                    {
                        pnlReset.Visible = false;
                        user.Password    = Utils.EncodePassword(newpass);
                        DomainManager.Update(user);
                        Utils.ResetCurrentUser();
                        Utils.ShowMessage(lblMsg, string.Format("Mật khẩu mới đã được gởi vào địa chỉ email <b>{0}</b>", email));
                        TNHelper.LogAction(user, LogType.UserLog, "Reset mật khẩu");
                    }
                    else
                    {
                        user.Password = oldpass;
                        DomainManager.Update(user);
                        Utils.ResetCurrentUser();
                        Utils.ShowMessage(lblMsg, "Gởi mật khẩu không thành công. Bạn hãy thử lại sau.");
                        TNHelper.LogAction(user, LogType.UserLog, "Reset mật khẩu không thành công.");
                    }
                }
            }
        }
예제 #9
0
        public ActionResult RealityCheckConfig(long domainId, string id, string realityCheckTimeout)
        {
            int limit = 0;

            if (!string.IsNullOrEmpty(realityCheckTimeout) && Int32.TryParse(realityCheckTimeout, out limit))
            {
                ViewData["RealityCheckTimeout"] = limit;
            }

            List <ceDomainConfigEx> domains = DomainManager.GetDomains();
            ceDomainConfigEx        domain  = domains.FirstOrDefault(d => d.DomainID == domainId);

            if (domain == null)
            {
                this.ViewData["ErrorMessage"] = "Invalid Url Parameter(s)!";
                return(this.View("Error"));
            }
            DomainManager.CurrentDomainID = domainId;
            ViewData["Domain"]            = domain;

            int vendorId = Int32.Parse(id);

            if (vendorId == (int)VendorID.NetEnt)
            {
                return(View("NetEntRealityCheckConfig"));
            }

            if (vendorId == (int)VendorID.Realistic)
            {
                return(View("RealisticRealityCheckConfig"));
            }

            if (vendorId == (int)VendorID.Microgaming)
            {
                return(View("MicrogamingRealityCheckConfig"));
            }
            else if (vendorId == (int)VendorID.QuickSpin)
            {
                return(View("QuickSpinRealityCheckConfig"));
            }
            else if (vendorId == (int)VendorID.PlaynGO)
            {
                return(View("PlaynGORealityCheckConfig"));
            }


            this.ViewData["ErrorMessage"] = String.Format("Invalid Url Parameter(s)!. Unknown vendor '{0}'", vendorId);
            return(this.View("Error"));
        }
예제 #10
0
        public static Dictionary <string, ISoftBetIntegration.Game> Get(long domainID, string lang)
        {
            ceDomainConfigEx domain;

            if (domainID == Constant.SystemDomainID)
            {
                domain = DomainManager.GetSysDomain();
            }
            else
            {
                domain = DomainManager.GetDomains().FirstOrDefault(d => d.DomainID == domainID);
            }

            return(null);
        }
예제 #11
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (string.Compare(e.CommandName, "delete", true) == 0)
            {
                int        id  = int.Parse(e.CommandArgument.ToString());
                Prediction obj = DomainManager.GetObject <Prediction>(id);

                if (obj != null && obj.PredictionGameUserDetailses.Count == 0)
                {
                    DomainManager.Delete(obj);
                    string msg = Page.Server.UrlEncode("Xóa dự đoán thành công");
                    Page.Response.Redirect(string.Format("/admincp/prediction-list?msg={0}", msg), true);
                }
            }
        }
예제 #12
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (string.Compare(e.CommandName, "delete", true) == 0)
            {
                int  id  = int.Parse(e.CommandArgument.ToString());
                User obj = DomainManager.GetObject <User>(id);

                if (obj != null)
                {
                    DomainManager.Delete(obj);
                    lblMsg.Text = "Xóa thành công.";
                    LoadData();
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AzureServiceBusManager"/> class.
        /// </summary>
        /// <param name="eventBusConfigurationList">The event bus configuration list.</param>
        /// <param name="domainManager">The domain manager.</param>
        public AzureServiceBusManager(EventBusConfiguration eventBusConfigurationList, IOptions <DomainManager> domainManager)
        {
            _eventBusConfiguration = eventBusConfigurationList;
            _domainManager         = domainManager.Value;

            if (_topicManager != null && _topicManager.Count == 0)
            {
                SetupAzureTopicProvider(domainManager.Value);
            }

            if (_queueManager != null && _queueManager.Count == 0)
            {
                SetupAzureQueueProvider(domainManager.Value);
            }
        }
예제 #14
0
        public void AddTest1()
        {
            DomainManager target = CreateManager();

            target.RemoveAll();
            Assert.Equal(0, target.Count());
            using (ConfigDatabase db = CreateConfigDatabase())
            {
                string name   = BuildDomainName(GetRndDomainID());
                Domain domain = new Domain(name);
                target.Add(db, domain);
                db.SubmitChanges();
                Assert.NotNull(target.Get(name));
            }
        }
예제 #15
0
        private static object GetBootstrapperContext(FrameworkName targetFramework, DomainManager.ApplicationMainInfo info)
        {
            var dnxHost = Assembly.Load("Microsoft.Dnx.Host");
            var contextType = dnxHost.GetType("Microsoft.Dnx.Host.BootstrapperContext");
            var bootstrapperContext = Activator.CreateInstance(contextType);
            contextType.GetProperty("OperatingSystem").SetValue(bootstrapperContext, info.OperatingSystem);
            contextType.GetProperty("OsVersion").SetValue(bootstrapperContext, info.OsVersion);
            contextType.GetProperty("Architecture").SetValue(bootstrapperContext, info.Architecture);
            contextType.GetProperty("RuntimeDirectory").SetValue(bootstrapperContext, info.RuntimeDirectory);
            contextType.GetProperty("ApplicationBase").SetValue(bootstrapperContext, info.ApplicationBase);
            contextType.GetProperty("TargetFramework").SetValue(bootstrapperContext, targetFramework);
            contextType.GetProperty("RuntimeType").SetValue(bootstrapperContext, "Clr");

            return bootstrapperContext;
        }
예제 #16
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string strId = Page.RouteData.Values["id"] as string;
            int    id    = 0;

            int.TryParse(strId, out id);

            User obj = DomainManager.GetObject <User>(id);

            if (obj != null)
            {
                DomainManager.Delete(obj);
                Page.Response.Redirect("/admincp/user-list");
            }
        }
        public static void ApplicationBaseTests(string filePath, string appBase, string expected)
        {
            filePath = TestPath(filePath);
            appBase  = TestPath(appBase);
            expected = TestPath(expected);

            var package = new TestPackage(filePath);

            if (appBase != null)
            {
                package.Settings["BasePath"] = appBase;
            }

            Assert.That(DomainManager.GetApplicationBase(package), Is.SamePath(expected));
        }
예제 #18
0
        public void AppDomainDefaultsToNotShadowCopy()
        {
            var context = new ServiceContext();

            context.Add(new SettingsService());
            var domainManager = new DomainManager();

            context.Add(domainManager);
            context.ServiceManager.InitializeServices();

            string         mockDll = MockAssembly.AssemblyPath;
            AppDomainSetup setup   = domainManager.CreateAppDomainSetup(new TestPackage(mockDll));

            Assert.That(setup.ShadowCopyFiles, Is.Null.Or.EqualTo("false"));
        }
예제 #19
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                BizQuestionGameSettings biz = new BizQuestionGameSettings();

                int playNum;
                int.TryParse(txtPlayNum.Text.Trim(), out playNum);
                biz.NumPlayPerDay = playNum;

                int time;
                int.TryParse(txtTime.Text.Trim(), out time);
                biz.Timer = time;

                int maxDisplayItem;
                int.TryParse(txtMaxDisplayItem.Text.Trim(), out maxDisplayItem);
                biz.MaxDisplayItem = maxDisplayItem;

                int gameid = 0;
                if (!string.IsNullOrEmpty(ddlQG.SelectedValue))
                {
                    int.TryParse(ddlQG.SelectedValue, out gameid);
                }

                biz.QuestionGameID = gameid;
                biz.IsPaused       = radPauseYes.Checked;

                Setting setting = DomainManager.GetObject <Setting>(2);
                if (setting == null)
                {
                    throw new Exception("No question game settings");
                }

                setting.SettingValue = Utils.SerializeObject <BizQuestionGameSettings>(biz);

                if (setting.Id == 0)
                {
                    DomainManager.Insert(setting);
                }
                else
                {
                    DomainManager.Update(setting);
                }

                TNHelper.RemoveCaches();
                Utils.ShowMessage(lblMsg, "Cập nhập cấu hình game thử tài kiến thức thành công.");
            }
        }
예제 #20
0
        public void Process(PipelineArgs args)
        {
            var domainName = Settings.GetSetting("DeferredRegistration.Domain");

            Assert.IsNotNullOrEmpty(domainName, "domainName");

            if (DomainManager.GetDomain(domainName) != null)
            {
                return;
            }

            using (new UserSwitcher("sitecore\\admin", true))
            {
                DomainManager.AddDomain(domainName);
            }
        }
예제 #21
0
        private Answer GetUserAnswer(Question p)
        {
            int    answerValue       = -1;
            string key               = string.Format("UserAnswerList-{0}", hfCache.Value);
            Dictionary <int, int> qa = CMSCache.Get(key) as Dictionary <int, int>;

            if (qa != null && qa.Count > 0)
            {
                if (!qa.TryGetValue(p.Id, out answerValue))
                {
                    answerValue = -1;
                }
            }

            return(DomainManager.GetObject <Answer>(answerValue));
        }
예제 #22
0
        public async Task <IActionResult> CreateCustomerMember([FromBody] CustomerMemberPostRp resource)
        {
            if (!ModelState.IsValid)
            {
                return(this.BadRequest(ModelState));
            }

            await _CustomerMemberService.CreateCustomerMember(resource);

            if (DomainManager.HasConflicts())
            {
                return(this.Conflict(DomainManager.GetConflicts()));
            }

            return(this.Ok(base.DefaultResponse));
        }
예제 #23
0
        /// <summary>
        /// Send a message to the node with the specified ID.
        /// </summary>
        /// <param name="message">The user message struct to be sent.</param>
        public void SendMessage(UserMessage message)
        {
            if (!HasDomain(message.DomainKey))
            {
                //get the assemblies
                Dictionary <string, byte[]> assemblies = DomainManager.GetDomainAssemblies(message.DomainKey);
                foreach (KeyValuePair <string, byte[]> assem in assemblies)
                {
                    deliverAssembly(assem.Key, assem.Value, message.DomainKey);
                }
            }
            assemblyLoadReset.WaitOne();
            SerializationEngine serializer = new SerializationEngine();

            client.Write(MessageType.USER_MESSAGE, serializer.Serialize(message));
        }
예제 #24
0
        public void GetTest6()
        {
            InitDomainRecords();
            DomainManager target = CreateManager();

            string[] names = TestDomainNames.ToArray();
            using (ConfigDatabase db = CreateConfigDatabase())
            {
                Domain[] actual = target.Get(db, names).ToArray();
                Assert.Equal(names.Length, actual.Length);
                foreach (Domain dom in actual)
                {
                    Assert.True(names.Contains(dom.Name));
                }
            }
        }
예제 #25
0
        public async Task <IActionResult> CreateUser([FromBody] UserPostRp resource)
        {
            if (!ModelState.IsValid)
            {
                return(this.BadRequest(ModelState));
            }

            await _userService.CreateUser(resource);

            if (DomainManager.HasConflicts())
            {
                return(this.Conflict(DomainManager.GetConflicts()));
            }

            return(this.Ok(new { UserId = await DomainManager.GetResult <string>("UserId") }));
        }
예제 #26
0
        public JsonResult SaveWcfApiCredentials(string wcfApiUsername, string wcfApiPassword)
        {
            if (!DomainManager.AllowEdit())
            {
                throw new Exception("Data modified is not allowed");
            }
            SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>();

            ceDomainConfig config = EnsureDomainConfigExists();
            config.WcfApiUsername = wcfApiUsername;
            config.WcfApiPassword = wcfApiPassword;
            query.Update(config);

            CacheManager.ClearCache(Constant.DomainCacheKey);
            return this.Json(new { @success = true });
        }
예제 #27
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            string strId = Page.RouteData.Values["id"] as string;
            int    id    = 0;

            int.TryParse(strId, out id);

            PredictionGame obj = DomainManager.GetObject <PredictionGame>(id);

            if (obj != null)
            {
                DomainManager.Delete(obj);
                string msg = Page.Server.UrlEncode("Xóa bộ đề game dự đoán thành công");
                Page.Response.Redirect(string.Format("/admincp/prediction-list?msg={0}", msg), true);
            }
        }
예제 #28
0
        public async Task <IActionResult> GetActivities(string userId)
        {
            if (!ModelState.IsValid)
            {
                return(this.BadRequest(ModelState));
            }

            var activities = await _userActivityQueryService.GetUserActivities(userId);

            if (DomainManager.HasNotFounds())
            {
                return(this.Conflict(DomainManager.GetNotFounds()));
            }

            return(this.Ok(activities));
        }
예제 #29
0
        public ActionResult LobbyResolver(long domainId, string id)
        {
            List <ceDomainConfigEx> domains = DomainManager.GetDomains();
            ceDomainConfigEx        domain  = domains.FirstOrDefault(d => d.DomainID == domainId);

            if (domain == null)
            {
                this.ViewData["ErrorMessage"] = "Invalid Url Parameter(s)!";
                return(this.View("Error"));
            }

            DomainManager.CurrentDomainID = domainId;
            ViewData["Domain"]            = domain;

            return(View("LobbyResolver"));
        }
        public static void ConfigFileTests(string filePath, string appBase, string configSetting, string expected)
        {
            filePath      = TestPath(filePath);
            appBase       = TestPath(appBase);
            configSetting = TestPath(configSetting);
            expected      = TestPath(expected);

            var package = new TestPackage(filePath);

            if (configSetting != null)
            {
                package.Settings["ConfigurationFile"] = configSetting;
            }

            Assert.That(DomainManager.GetConfigFile(appBase, package), Is.EqualTo(expected));
        }
예제 #31
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (string.Compare(e.CommandName, "delete", true) == 0)
            {
                int id = 0;
                int.TryParse(e.CommandArgument.ToString(), out id);

                DM.Content content = DomainManager.GetObject <DM.Content>(id);
                if (content != null)
                {
                    DomainManager.Delete(content);
                    LoadData();
                    Utils.ShowMessage(lblMsg, "Xóa thông bthành công");
                }
            }
        }
예제 #32
0
        protected void rptQuestion_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (string.Compare(e.CommandName, "delete", true) == 0)
            {
                int id = 0;
                int.TryParse(e.CommandArgument.ToString(), out id);

                QuestionUser qu = DomainManager.GetObject <QuestionUser>(id);
                if (qu != null)
                {
                    DomainManager.Delete(qu);
                    TNHelper.RemoveRankingCaches();
                    LoadData();
                    Utils.ShowMessage(lblMsg, "Xóa thông tin game thử tài kiến thức của người chơi thành công.");
                }
            }
        }
예제 #33
0
 protected ServerBase(DomainManager domains, ServerBase clone)
 {
     Id               = clone.Id;
     Settings         = clone.Settings;
     _Domains         = domains;
     IsRunning        = clone.IsRunning;
     Channels         = clone.Channels;
     UsersByMask      = clone.UsersByMask;
     UsersById        = clone.UsersById;
     UsersByAccount   = clone.UsersByAccount;
     Created          = clone.Created;
     NetworkName      = clone.NetworkName;
     Certificates     = clone.Certificates;
     Cache            = clone.Cache;
     LocalUsers       = clone.LocalUsers;
     NetworkOperators = clone.NetworkOperators;
 }
예제 #34
0
        protected override void ProcessRecord()
        {
            if (DomainManager.DomainExists(Name))
            {
                WriteError(typeof(DuplicateNameException), $"Cannot create a duplicate domain with name '{Name}'.",
                           ErrorIds.DomainAlreadyExists, ErrorCategory.InvalidArgument, Name);
                return;
            }

            if (!ShouldProcess(Name, "Create domain"))
            {
                return;
            }

            DomainManager.AddDomain(Name, LocallyManaged);
            WriteObject(DomainManager.GetDomain(Name));
        }
예제 #35
0
        public JsonResult RemoveDataItem(string type, long id)
        {
            if (!DomainManager.AllowEdit())
            {
                throw new Exception("Data modified is not allowed");
            }
            DataDictionaryAccessor dda = DataDictionaryAccessor.CreateInstance<DataDictionaryAccessor>();
            var item = dda.GetById(id);

            SqlQuery<ceDataItem> query = new SqlQuery<ceDataItem>();
            query.DeleteByKey(id);

            ChangeLogAccessor cla = ChangeLogAccessor.CreateInstance<ChangeLogAccessor>();
            cla.BackupChangeLog(CurrentUserSession.UserSessionID, CurrentUserSession.UserID, "CeDataDictionary", id, DateTime.Now, "DELETE", Newtonsoft.Json.JsonConvert.SerializeObject(item), null);

            return this.Json(new { @success = true }, JsonRequestBehavior.AllowGet);
        }
예제 #36
0
        public void OnTimer(object sender, System.Timers.ElapsedEventArgs args)
        {
#if DEBUG
            eventLog1.WriteEntry($"OnTimer start", EventLogEntryType.Information, eventId++);
#endif
            foreach (string dom in _domain.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
            {
                string message = DomainManager.UpdateDomainGandi(dom, _apikey);
                if (!string.IsNullOrEmpty(message))
                {
                    eventLog1.WriteEntry(message, EventLogEntryType.Error, eventId++);
                }
            }

#if DEBUG
            eventLog1.WriteEntry($"OnTimer Stop", EventLogEntryType.Information, eventId++);
#endif
        }
        public void AppDomainSetUpCorrect()
        {
            ServiceContext context = new ServiceContext();
            context.Add(new SettingsService());
            var domainManager = new DomainManager();
            context.Add(domainManager);
            context.ServiceManager.InitializeServices();

            string mockDll = MockAssembly.AssemblyPath;
            AppDomainSetup setup = domainManager.CreateAppDomainSetup(new TestPackage(mockDll));

            Assert.That(setup.ApplicationName, Does.StartWith("Tests_"));
            Assert.That(setup.ApplicationBase, Is.SamePath(Path.GetDirectoryName(mockDll)), "ApplicationBase");
            Assert.That( 
                Path.GetFileName( setup.ConfigurationFile ),
                Is.EqualTo("mock-nunit-assembly.dll.config").IgnoreCase,
                "ConfigurationFile");
            Assert.AreEqual( null, setup.PrivateBinPath, "PrivateBinPath" );
            Assert.That(setup.ShadowCopyDirectories, Is.SamePath(Path.GetDirectoryName(mockDll)), "ShadowCopyDirectories" );
        }
        public void Get_AddressOrDomainTest()
        {              
            InitAddressRecords();
            string addressType = "SMTP";

            DomainManager dMgr = new DomainManager(CreateConfigStore());
            Domain domain = new Domain("address1.domain1.com");
            domain.Status = EntityStatus.New;
            dMgr.Add(domain);
            domain = new Domain("address2.domain2.com");
            domain.Status = EntityStatus.Enabled;
            dMgr.Add(domain);
            
            AddressManager mgr = CreateManager();

            string[] emailAddresses = new[] { "*****@*****.**", "*****@*****.**" };
            
            IEnumerable<Address> actual = mgr.Get(emailAddresses, EntityStatus.New);
            Assert.Equal(0, actual.Count());

            //
            // Now search with domainSearchEnabled = true
            //
            actual = mgr.Get(emailAddresses, true, EntityStatus.Enabled);
            Assert.Equal(0, actual.Count());

            actual = mgr.Get(emailAddresses, true, EntityStatus.New);
            Assert.Equal(emailAddresses.Length, actual.Count());


            for (int t = 0; t < actual.Count(); t++)
            {
                Assert.True(emailAddresses.Contains(actual.ToArray()[t].EmailAddress));
                Assert.Equal(EntityStatus.New, actual.ToArray()[t].Status);
                Assert.Equal(addressType, actual.ToArray()[t].Type);
            }

            emailAddresses = new[] { "*****@*****.**", "*****@*****.**" };
            actual = mgr.Get(emailAddresses, true, EntityStatus.Enabled);
            Assert.Equal(emailAddresses.Length, actual.Count());

            //
            // domainSearchEnabled and no status.
            //
            actual = mgr.Get(emailAddresses, true);
            Assert.Equal(emailAddresses.Length, actual.Count());
            for (int t = 0; t < actual.Count(); t++)
            {
                Assert.True(emailAddresses.Contains(actual.ToArray()[t].EmailAddress));
                Assert.Equal(EntityStatus.Enabled, actual.ToArray()[t].Status);
                Assert.Equal(addressType, actual.ToArray()[t].Type);
            }
        }
        public void Get_AddressAndDomainTest()
        {
            InitAddressRecords();
            string addressType = "SMTP";

            DomainManager dMgr = new DomainManager(CreateConfigStore());
            Domain domain = new Domain("address1.domain1.com");
            domain.Status = EntityStatus.New;
            dMgr.Add(domain);

            //
            // [email protected] aready exists
            //

            AddressManager mgr = CreateManager();

            string[] emailAddresses = new[] { "*****@*****.**", "*****@*****.**", "*****@*****.**" };

            IEnumerable<Address> actual = mgr.Get(emailAddresses, EntityStatus.New);
            Assert.Equal(1, actual.Count());

            //
            // Now search with domainSearchEnabled = true
            //
            actual = mgr.Get(emailAddresses, true, EntityStatus.Enabled);
            Assert.Equal(0, actual.Count());

            actual = mgr.Get(emailAddresses, true, EntityStatus.New);
            Assert.Equal(emailAddresses.Length, actual.Count());


            for (int t = 0; t < actual.Count(); t++)
            {
                Assert.True(emailAddresses.Any(e => e.Equals(actual.ToArray()[t].EmailAddress, StringComparison.OrdinalIgnoreCase)));
                Assert.Equal(EntityStatus.New, actual.ToArray()[t].Status);
                Assert.Equal(addressType, actual.ToArray()[t].Type);
            }

        }
        public void Get_RoutedAddress()
        {
            InitAddressRecords();
            DomainManager dMgr = new DomainManager(CreateConfigStore());
            Domain domain = new Domain("address1.domain1.com");
            domain.Status = EntityStatus.Enabled;
            dMgr.Add(domain);

            string addressType = "Undeliverable";
            AddressManager aMgr = new AddressManager(CreateConfigStore());
            MailAddress address = new MailAddress("*****@*****.**");
            aMgr.Add(address, EntityStatus.Enabled, addressType);
            //
            // [email protected] aready exists
            //

            AddressManager mgr = CreateManager();

            string[] emailAddresses = new[] { "*****@*****.**" };

            IEnumerable<Address> actual = mgr.Get(emailAddresses, true, EntityStatus.Enabled);
            Assert.Equal(1, actual.Count());


            for (int t = 0; t < actual.Count(); t++)
            {
                Assert.True(emailAddresses.Any(e => e.Equals(actual.ToArray()[t].EmailAddress, StringComparison.OrdinalIgnoreCase)));
                Assert.Equal(EntityStatus.Enabled, actual.ToArray()[t].Status);
                Assert.Equal(addressType, actual.ToArray()[t].Type);
            }





            actual = mgr.Get(emailAddresses, EntityStatus.Enabled);
            Assert.Equal(1, actual.Count());


            for (int t = 0; t < actual.Count(); t++)
            {
                Assert.True(emailAddresses.Any(e => e.Equals(actual.ToArray()[t].EmailAddress, StringComparison.OrdinalIgnoreCase)));
                Assert.Equal(EntityStatus.Enabled, actual.ToArray()[t].Status);
                Assert.Equal(addressType, actual.ToArray()[t].Type);
            }




            actual = mgr.Get(emailAddresses, true);
            Assert.Equal(1, actual.Count());


            for (int t = 0; t < actual.Count(); t++)
            {
                Assert.True(emailAddresses.Any(e => e.Equals(actual.ToArray()[t].EmailAddress, StringComparison.OrdinalIgnoreCase)));
                Assert.Equal(EntityStatus.Enabled, actual.ToArray()[t].Status);
                Assert.Equal(addressType, actual.ToArray()[t].Type);
            }




            actual = mgr.Get(emailAddresses);
            Assert.Equal(1, actual.Count());


            for (int t = 0; t < actual.Count(); t++)
            {
                Assert.True(emailAddresses.Any(e => e.Equals(actual.ToArray()[t].EmailAddress, StringComparison.OrdinalIgnoreCase)));
                Assert.Equal(EntityStatus.Enabled, actual.ToArray()[t].Status);
                Assert.Equal(addressType, actual.ToArray()[t].Type);
            }



        }