public void Test_GetDataStoreName_FromNames()
        {
            using (LogGroup logGroup = LogGroup.Start("Testing the GetDataStoreName function from a provided type.", NLog.LogLevel.Debug))
            {
                TestArticle e1 = new TestArticle();
                e1.ID = Guid.NewGuid();
                e1.Title = "Test 1";

                TestArticlePage e2 = new TestArticlePage();
                e2.ID = Guid.NewGuid();
                e2.Title = "Test 2";

                //e2.ArticleID = e1.ID;

                string name = DataUtilities.GetDataStoreName(e1.GetType().Name, e2.GetType().Name);

                Assert.AreEqual(e1.ShortTypeName + "-" + e2.ShortTypeName, name, "The wrong data store name was returned.");
            }
        }
        public virtual void Test_Activate_SingleProperty_2References()
        {
            using (LogGroup logGroup = LogGroup.Start("Testing the Activate function with 2 references.", NLog.LogLevel.Debug))
            {
                TestArticle article = new TestArticle();
                article.ID = Guid.NewGuid();
                Guid articleID = article.ID;
                article.Title = "Test";

                TestArticlePage page = new TestArticlePage();
                page.ID = Guid.NewGuid();
                Guid pageID = page.ID;
                page.Title = "Test Page";

                TestArticlePage page2 = new TestArticlePage();
                page2.ID = Guid.NewGuid();
                Guid page2ID = page2.ID;
                page2.Title = "Test Page 2";

                article.Pages = new TestArticlePage[] {page, page2};
                //user.Roles = Collection<TestRole>.Add(user.Roles, role);

                DataAccess.Data.Saver.Save(page);
                DataAccess.Data.Saver.Save(page2);

                DataAccess.Data.Saver.Save(article);

                //  TODO: Check if needed
                //page = null;
                //page2 = null;
                //article = null;

                EntityReferenceCollection references = DataAccess.Data.Referencer.GetReferences(article.GetType().Name, page.GetType().Name);

                Assert.IsNotNull(references, "references == null");

                Assert.AreEqual(2, references.Count, "Invalid number of references found.");

                TestArticle foundArticle = DataAccess.Data.Reader.GetEntity<TestArticle>("ID", articleID);

                Assert.IsNotNull(foundArticle, "The foundArticle variable is null.");

                DataAccess.Data.Activator.Activate(foundArticle, "Pages");

                Assert.IsNotNull(foundArticle.Pages, "The article.Pages property is null.");
                Assert.AreEqual(2, foundArticle.Pages.Length, "article.Pages.Length != 2.");

                if (foundArticle.Pages != null && foundArticle.Pages.Length == 2)
                {
                    TestArticlePage foundPage1 = foundArticle.Pages[0];
                    TestArticlePage foundPage2 = foundArticle.Pages[1];

                    //if (foundPage2.ID.ToString() == pageID.ToString())
                    //{
                    //	TestArticlePage tmp = foundPage2;
                    //	foundPage2 = foundPage1;
                    //	foundPage1 = tmp;
                    //}

                    // Use an array and IndexOf function so the match will work in any order
                    Guid[] pageIDs = new Guid[] {pageID, page2ID};

                    Assert.IsTrue(Array.IndexOf(pageIDs, foundPage1.ID) > -1, "First found page has the wrong ID.");
                    Assert.IsTrue(Array.IndexOf(pageIDs, foundPage2.ID) > -1, "Second found page has the wrong ID.");

                    //Assert.AreEqual(pageID.ToString() + "---" + page2ID.ToString(), foundPage1.ID.ToString() + "---" + foundPage2.ID.ToString(), "IDs of the reference don't match.");

                }
            }
        }