public News2Controller() { string host_Test = string.Format("{0}:{1}" , ConfigurationManager.AppSettings["OrientTargetHost"], ConfigurationManager.AppSettings["OrientPort"]); string host_Source = string.Format("{0}:{1}" , ConfigurationManager.AppSettings["OrientSourceHost"], ConfigurationManager.AppSettings["OrientPort"]); targetManager = new Managers.Manager( ConfigurationManager.AppSettings["OrientUnitTestDB"] , host_Test , ConfigurationManager.AppSettings["orient_dev_login"] , ConfigurationManager.AppSettings["orient_dev_pswd"] ); Managers.Manager sourceManager = new Managers.Manager( ConfigurationManager.AppSettings["OrientSourceDB"] , host_Source , ConfigurationManager.AppSettings["orient_login"] , ConfigurationManager.AppSettings["orient_pswd"] ); acc = targetManager.UserAcc(); if (acc == null) { throw new Exception("No account found"); } if (targetManager.GetPersonUOW().GetPersonByAccount(acc) == null) { POCO.Person personToAdd = sourceManager.GetPersonUOW().GetPersonByAccount(acc); if (personToAdd == null) { throw new Exception("No user object in source db exists"); } POCO.Person personAdded = targetManager.GetPersonUOW().CreatePerson(personToAdd); } }
//FUNCTIONAL TESTS public static void UOWFunctionalCheck() { //GET CLASS Managers.Manager mngCl = new Managers.Manager("dev_db", null); IOrientRepo rp = mngCl.GetRepo(); GetClass gc = rp.GetClass <Person>("dev_db", null); //Managers.Manager mng = new Managers.Manager(ConfigurationManager.AppSettings["OrientDevDB"],null); Managers.Manager mng = new Managers.Manager(ConfigurationManager.AppSettings["OrientUnitTestDB"], null); Managers.Manager mngSource = new Managers.Manager(ConfigurationManager.AppSettings["OrientSourceDB"], null); PersonUOWs.PersonUOW pu = mng.GetPersonUOW(); NewsUOWs.NewsRealUow nu = mng.GetNewsUOW(); Managers.Manager mngPerson = new Managers.Manager(ConfigurationManager.AppSettings["OrientSourceDB"]); PersonUOWs.PersonUOW personToGetUOW = mngPerson.GetPersonUOW(); POCO.News newsToAdd0 = new News() { GUID = "119", content = "s \"a \"a t " }; POCO.Person newsMaker = pu.SearchByName("Neprintsevia").FirstOrDefault(); POCO.Person likeMaker = pu.SearchByName("Person1").FirstOrDefault(); POCO.Person troubleMaker = pu.SearchByName("Person0").FirstOrDefault(); GETparameters gp = new GETparameters() { offest = 5, published = true, pinned = true, asc = true, author = newsMaker }; JSONManager jm = new JSONManager(); //ABSENT PERSON CHECK Random rnd = new Random(); //News ns = nu.GetNewsByGUID("2370b972-48d4-4e49-95ad-b99ba5382042"); //News ns = nu.GetNewsByGUID("e7bc87ec-f649-4748-b4cb-d2863f780f1c"); //nu.GetNewsByGUID("f7557c27-f889-4aab-91ce-ba15e34e3981"); //News ns = nu.GetNewsByGUID("f7557c27-f889-4aab-91ce-ba15e34e3981"); var a = nu.GetNews(5, null, null); int acc = (int)rnd.Next(0, 10000); Person personAbsent = new Person() { Name = "PersonAbsent", sAMAccountName = "absent" + acc }; string newsContent = "{\"conntent_\":\"news text\",\"name\":\"News name\"}"; }