Exemplo n.º 1
0
        private static void isPublicPropertiesSerialized(object o, string s)
        {
            Assert.IsNotNull(o);
            Assert.IsNotNull(s);
            var properties = GetClass.Properties(o.GetType());

            foreach (var p in properties)
            {
                if (!p.CanRead)
                {
                    continue;
                }
                if (!p.CanWrite)
                {
                    continue;
                }
                if (p.GetGetMethod(false) == null)
                {
                    continue;
                }
                if (p.GetSetMethod(false) == null)
                {
                    continue;
                }
                var n = p.Name;
                Assert.IsTrue(s.Contains(n), n);
            }
        }
Exemplo n.º 2
0
        private static void IsPublicPropertiesSerialized(object o, string s)
        {
            if (o == null)
            {
                throw new ArgumentNullException(nameof(o));
            }
            if (s == null)
            {
                throw new ArgumentNullException(nameof(s));
            }
            Assert.IsNotNull(o);
            Assert.IsNotNull(s);
            var properties = GetClass.Properties(o.GetType());

            foreach (var p in properties)
            {
                if (!p.CanRead)
                {
                    continue;
                }
                if (!p.CanWrite)
                {
                    continue;
                }
                var n = p.Name;
                Assert.IsTrue(s.Contains(n), n);
            }
        }
Exemplo n.º 3
0
        [TestMethod] public void NamespaceTest()
        {
            var t = typeof(object);

            Assert.AreEqual(t.Namespace, GetClass.Namespace(t));
            Assert.AreEqual(string.Empty, GetClass.Namespace(null));
        }
Exemplo n.º 4
0
        private static void TestNull(Type t)
        {
            var a = GetClass.Members(t);

            Assert.IsInstanceOfType(a, typeof(List <MemberInfo>));
            Assert.AreEqual(0, a.Count);
        }
        [TestMethod] public void CurrenciesTest()
        {
            var p = GetClass.Property <MoneyCalculatorView>(
                GetMember.Name <MoneyCalculatorView>(x => x.Currencies));

            Assert.IsFalse(p.CanWrite);
            Assert.IsTrue(p.CanRead);
        }
Exemplo n.º 6
0
        public void PropertyTest()
        {
            var a = GetClass.Property <classTest>("F");

            Assert.IsNotNull(a);
            Assert.IsInstanceOfType(a, typeof(PropertyInfo));
            Assert.AreEqual("F", a.Name);
        }
Exemplo n.º 7
0
        [TestMethod] public void ReadWritePropertyValuesTest()
        {
            var o = GetRandom.Object <TestClass>();
            var l = GetClass.ReadWritePropertyValues(o);

            Assert.AreEqual(1, l.Count);
            Assert.AreEqual(l[0], o.F);
        }
Exemplo n.º 8
0
        [TestMethod] public void PropertiesTest()
        {
            var a = GetClass.Properties(typeof(TestClass));

            Assert.IsNotNull(a);
            Assert.IsInstanceOfType(a, typeof(List <PropertyInfo>));
            Assert.AreEqual(1, a.Count);
            Assert.AreEqual("F", a[0].Name);
        }
Exemplo n.º 9
0
        private static void testMember(Type t)
        {
            var a = GetClass.Members(t, PublicBindingFlagsFor.AllMembers, false);
            var e = t.GetMembers(PublicBindingFlagsFor.AllMembers);

            Assert.AreEqual(e.Length, a.Count);
            Assert.AreEqual(10, a.Count);
            foreach (var v in e)
            {
                Assert.IsTrue(a.Contains(v));
            }
            Assert.AreEqual(7, GetClass.Members(t).Count);
        }
Exemplo n.º 10
0
        public virtual void IsTested()
        {
            var t = typeof(T);
            var m = GetClass.Members(t, GetPublic.Declared);

            Members = m.Select(e => e.Name).ToList();
            RemoveTested();
            if (Members.Count == 0)
            {
                return;
            }
            Assert.Inconclusive(NotTested, Members[0]);
        }
Exemplo n.º 11
0
        private void validatePropertyValues()
        {
            var l = GetClass.ReadWritePropertyValues(obj);

            Assert.AreEqual(l.Count, list.Count);
            for (var i = list.Count; i > 0; i--)
            {
                var e = l[i - 1];
                Assert.IsTrue(list.Contains(e));
                list.Remove(e);
            }
            Assert.AreEqual(0, list.Count);
        }
Exemplo n.º 12
0
        //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\"}";
        }
Exemplo n.º 13
0
        public void isTested()
        {
            if (type == null)
            {
                Assert.Inconclusive(notSpecified);
            }
            var m = GetClass.Members(type, PublicBindingFlagsFor.DeclaredMembers);

            members = m.Select(e => e.Name).ToList();
            removeTested();
            if (members.Count == 0)
            {
                return;
            }
            Assert.Fail(notTested, members[0]);
        }
Exemplo n.º 14
0
        private void Start()
        {
            //get the title of undegrad degree 1
            get = new GetClass();
            string jsonDegrees = get.GET("/degrees/");

            degrees = JToken.Parse(jsonDegrees).ToObject <Degrees>();

            titleUndergrad1.Text = degrees.undergraduate[0].title;

            //create ListView
            for (int i = 0; i < degrees.undergraduate[0].concentrations.Count; i++)
            {
                concentrationsUndergrad1.Items.Add(degrees.undergraduate[0].concentrations[i]);
            }
        }
Exemplo n.º 15
0
        public virtual void IsTested()
        {
            if (type == null)
            {
                Assert.Inconclusive(notSpecified);
            }
            var m = GetClass.Members(type, GetPublic.Declared);

            members = m.Select(e => e.Name).ToList();
            removeTested();
            if (members.Count == 0)
            {
                return;
            }
            Assert.Inconclusive(notTested, members[0]);
        }
Exemplo n.º 16
0
        [TestMethod] public virtual void IsTested()
        {
            if (Type == null)
            {
                NotTested(NotSpecified);
            }
            var m = GetClass.Members(Type, PublicFlagsFor.Declared);

            Members = m.Select(e => e.Name).ToList();
            RemoveTested();
            if (Members.Count == 0)
            {
                return;
            }
            NotTested("<{0}> is not tested", Members[0]);
        }
Exemplo n.º 17
0
        public void PropertyTest()
        {
            void test(string name)
            {
                Assert.AreEqual(name, GetClass.Property <ProfileViewModel>(name).Name);
            }

            Assert.IsNull(GetClass.Property <ProfileViewModel>(null));
            Assert.IsNull(GetClass.Property <ProfileViewModel>(String.Empty));
            Assert.IsNull(GetClass.Property <ProfileViewModel>("bla bla"));
            test(GetMember.Name <ProfileViewModel>(m => m.ID));
            test(GetMember.Name <ProfileViewModel>(m => m.Name));
            test(GetMember.Name <ProfileViewModel>(m => m.Location));
            test(GetMember.Name <ProfileViewModel>(m => m.BirthDay));
            test(GetMember.Name <ProfileViewModel>(m => m.Gender));
        }
Exemplo n.º 18
0
        [TestMethod] public void PropertyTest()
        {
            void test(string name)
            {
                Assert.AreEqual(name, GetClass.Property <CountryViewModel>(name).Name);
            }

            Assert.IsNull(GetClass.Property <CountryViewModel>(null));
            Assert.IsNull(GetClass.Property <CountryViewModel>(String.Empty));
            Assert.IsNull(GetClass.Property <CountryViewModel>("bla bla"));
            test(GetMember.Name <CountryViewModel>(m => m.Alpha3Code));
            test(GetMember.Name <CountryViewModel>(m => m.Alpha2Code));
            test(GetMember.Name <CountryViewModel>(m => m.Name));
            test(GetMember.Name <CountryViewModel>(m => m.ValidFrom));
            test(GetMember.Name <CountryViewModel>(m => m.ValidTo));
        }
Exemplo n.º 19
0
        public void IsTested()
        {
            if (type == null)
            {
                Assert.Inconclusive(NotSpecified);               //kui tüüpi pole, siis annab ta mulle teada, et sellist tüüpi polegi
            }
            var m = GetClass.Members(type, PublicBindingFlagsFor.DeclaredMembers);

            Members = m.Select(e => e.Name).ToList();
            RemoveTested();

            if (Members.Count == 0)
            {
                return;
            }
            Assert.Fail(NotTested, Members[0]);
        }
Exemplo n.º 20
0
        public void IsTested()
        {
            if (type == null)
            {
                Assert.Inconclusive(notSpecified);                                 //kui tuup pole maaratud, siis seda tuupi pole olemas
            }
            var m = GetClass.Members(type, PublicBindingFlagsFor.DeclaredMembers); //annab type katte

            members = m.Select(e => e.Name).ToList();
            removeTested();

            if (members.Count == 0)
            {
                return;
            }
            Assert.Fail(notTested, members[0]);
        }
Exemplo n.º 21
0
        [TestMethod] public void PropertyTest()
        {
            void test(string name)
            {
                Assert.AreEqual(name, GetClass.Property <BidViewModel>(name).Name);
            }

            Assert.IsNull(GetClass.Property <BidViewModel>(null));
            Assert.IsNull(GetClass.Property <BidViewModel>(String.Empty));
            Assert.IsNull(GetClass.Property <BidViewModel>("bla bla"));
            test(GetMember.Name <BidViewModel>(m => m.ID));
            test(GetMember.Name <BidViewModel>(m => m.ProductId));
            test(GetMember.Name <BidViewModel>(m => m.UserId));
            test(GetMember.Name <BidViewModel>(m => m.Price));
            test(GetMember.Name <BidViewModel>(m => m.ValidFrom));
            test(GetMember.Name <BidViewModel>(m => m.ValidTo));
        }
Exemplo n.º 22
0
        [TestMethod] public void PropertyTest()
        {
            void test(string name)
            {
                Assert.AreEqual(name, GetClass.Property <AccountView>(name).Name);
            }

            Assert.IsNull(GetClass.Property <AccountView>(null));
            Assert.IsNull(GetClass.Property <AccountView>(String.Empty));
            Assert.IsNull(GetClass.Property <AccountView>("bla bla"));
            test(GetMember.Name <AccountView>(m => m.Balance));
            test(GetMember.Name <AccountView>(m => m.AspNetUserId));
            test(GetMember.Name <AccountView>(m => m.Status));
            test(GetMember.Name <AccountView>(m => m.Type));
            test(GetMember.Name <AccountView>(m => m.ValidFrom));
            test(GetMember.Name <AccountView>(m => m.ValidTo));
        }
Exemplo n.º 23
0
 void LoadCourses()
 {
     foreach (Transform child in contentPanel.transform)
     {
         Destroy(child.gameObject);
     }
     foreach (CourseData course in courses)
     {
         Transform newButton = (Instantiate(courseButton) as GameObject).transform;
         newButton.SetParent(contentPanel, false);
         newButton.GetComponentInChildren <Text>().text = course.code;
         GetClass classButton = newButton.GetComponent <GetClass>();
         if (classButton != null)
         {
             classButton.course = course;
         }
     }
 }
Exemplo n.º 24
0
        public GetClass GetClass(int ClassId)
        {
            IEnumerable <ClassResponse> data;
            GetClass getClass = new GetClass();

            data = (from classes in _ObjContext.Classes
                    join scheduleDate in _ObjContext.ScheduleDates on classes.ClassId equals scheduleDate.ClassId into scheduleDate1
                    from scheduleDate2 in scheduleDate1.DefaultIfEmpty()
                    join splitClass in _ObjContext.ClassSplits on classes.ClassId equals splitClass.ClassId into splitClass1
                    from splitClass2 in splitClass1.DefaultIfEmpty()
                    where classes.IsActive == true && classes.IsDeleted == false &&
                    classes.ClassId == ClassId
                    select new ClassResponse
            {
                ClassId = classes.ClassId,
                ClassHeaderId = classes.ClassHeaderId,
                ClassNumber = classes.ClassNumber,
                Name = classes.Name,
                AgeGroup = classes.AgeGroup,
                IsNSBAMember = classes.IsNSBAMember,
                Location = classes != null?classes.Location:"",
                ScheduleDate = scheduleDate2 != null? scheduleDate2.Date:null,
                SchedulTime = scheduleDate2 != null ? scheduleDate2.Time:null,
                SplitNumber = splitClass2 != null?splitClass2.SplitNumber:0,
                ChampionShipIndicator = splitClass2 != null ? splitClass2.ChampionShipIndicator:false,
                getClassSplit = (from splitClass in _ObjContext.ClassSplits
                                 where  splitClass.IsActive == true && splitClass.IsDeleted == false &&
                                 splitClass.ClassId == ClassId
                                 select new GetClassSplit
                {
                    Entries = splitClass.Entries
                }).ToList()
            });

            if (data.Count() != 0)
            {
                getClass.classResponse = data.ToList();
                getClass.TotalRecords  = data.Count();
            }
            return(getClass);
        }
Exemplo n.º 25
0
    public void Die()
    {
        Debug.Log("Player Dies");

        if (PartyManager.Instance.Classes.Count == 1)
        {
            Death();
        }

        if (PartyManager.Instance.pieceskilled > 1)
        {
            Death();
        }
        else
        {
            RigidBody.velocity = Vector2.zero;
            Life += MaxLife / 2;
            PartyManager.Instance.PieceKilled(GetClass.GetType().Name);
            CanvasManager.Instance.CurrentPanel = CanvasManager.Instance.ChangePanel;
        }
    }
Exemplo n.º 26
0
        private static void setValuesForProperties(object o)
        {
            if (o is null)
            {
                return;
            }
            var t          = o.GetType();
            var properties = GetClass.Properties(t);

            foreach (var p in properties)
            {
                if (!p.CanWrite)
                {
                    continue;
                }
                if (p.PropertyType.Name == t.Name)
                {
                    continue;
                }
                var v = GetRandom.Value(p.PropertyType);
                p.SetValue(o, v);
            }
        }
Exemplo n.º 27
0
        public virtual bool Contains(string searchString)
        {
            if (string.IsNullOrEmpty(searchString))
            {
                return(true);
            }
            searchString = searchString.ToLower();
            var values = GetClass.ReadWritePropertyValues(this);

            foreach (var value in values)
            {
                if (value is null)
                {
                    continue;
                }
                if (value.ToString().ToLower().Contains(searchString))
                {
                    return(true);
                }
            }

            return(GetType().Name.ToLower().Contains(searchString));
        }
Exemplo n.º 28
0
 public override void TestInitialize()
 {
     base.TestInitialize();
     obj  = getRandomObject();
     list = GetClass.ReadWritePropertyValues(obj);
 }
Exemplo n.º 29
0
        private void Start()
        {
            //get the about
            get = new GetClass();

            // get people
            string jsonPeople = get.GET("/people/");

            people = JToken.Parse(jsonPeople).ToObject <People>();

            //get degrees
            string jsonDegrees = get.GET("/degrees/");

            degrees = JToken.Parse(jsonDegrees).ToObject <Degrees>();

            //get employment
            string jsonEmployment = get.GET("/employment/");

            employment = JToken.Parse(jsonEmployment).ToObject <Employment>();

            //get footer
            string jsonFooter = get.GET("/footer/");

            footer = JToken.Parse(jsonFooter).ToObject <Footer>();
            lb_socialTitle.Text = footer.social.title;
            lbtweet.Text        = footer.social.tweet;

            ///////////////TwitterLink//////////////////////

            LinkLabel.Link facebookLink = new LinkLabel.Link();
            facebookLink.LinkData = footer.social.facebook;
            link_facebook.Text    = "Facebook";
            link_facebook.Links.Add(facebookLink);

            LinkLabel.Link twitterLink = new LinkLabel.Link();
            twitterLink.LinkData = footer.social.twitter;
            link_twitter.Text    = "Twitter";
            link_twitter.Links.Add(twitterLink);

            ////////////////About/////////////////////////////////
            string jsonAbout = get.GET("/about/");

            about = JToken.Parse(jsonAbout).ToObject <About>();
            //Console.WriteLine(jsonAbout);
            lbl_about_title.Text       = about.title;
            lbl_about_description.Text = about.description;
            lbl_about_quote.Text       = "\"" + about.quote + "\"";
            lbl_about_quoteAuthor.Text = "~" + about.quoteAuthor;

            //Console.WriteLine(jsonDegrees);

            int x = 20;
            int y = 20;

            foreach (Undergraduate allDegrees in degrees.undergraduate)
            {
                //create objects
                Label   labelTitle            = new Label();
                Label   labelDescription      = new Label();
                ListBox concentrationsListBox = new ListBox();

                //properties
                labelDescription.Location      = new Point(x, 130);
                concentrationsListBox.Location = new Point(x, 300);
                labelTitle.Location            = new Point(x, y);
                x += 400;

                // labelTitle location
                labelTitle.AutoSize = false;
                labelTitle.Height   = 100;
                labelTitle.Width    = 200;

                labelDescription.AutoSize = false;
                labelDescription.Height   = 100;
                labelDescription.Width    = 250;

                concentrationsListBox.Height = 100;
                concentrationsListBox.Width  = 250;

                // lopp to get all concentrations
                for (int i = 0; i < allDegrees.concentrations.Count(); i++)
                {
                    concentrationsListBox.Items.Add(allDegrees.concentrations[i]);
                }

                this.tabUndergradDegree.Controls.Add(labelTitle);
                this.tabUndergradDegree.Controls.Add(labelDescription);
                this.tabUndergradDegree.Controls.Add(concentrationsListBox);


                labelTitle.Text       = allDegrees.title;
                labelDescription.Text = allDegrees.description;

                ////////////////////Faculty Listview///////////////////////////

                // populates listView

                foreach (Faculty member in people.faculty)
                {
                    ListViewItem memberItem = new ListViewItem(new String[]
                    {
                        member.name,
                        member.username,
                        member.tagline,
                        member.title,
                        member.interestArea,
                        member.office,
                        member.website,
                        member.phone,
                        member.email,
                        member.facebook,
                        member.twitter
                    }
                                                               );

                    peopleListView.Items.Add(memberItem);
                }


                foreach (Staff staff in people.staff)
                {
                    ListViewItem staffItem = new ListViewItem(new String[]
                    {
                        staff.name,
                        staff.username,
                        staff.tagline,
                        staff.title,
                        staff.interestArea,
                        staff.office,
                        staff.website,
                        staff.phone,
                        staff.email,
                        staff.facebook,
                        staff.twitter
                    }
                                                              );

                    staffListView.Items.Add(staffItem);
                }
            }
        }
Exemplo n.º 30
0
 static void Test(string name)
 => Assert.AreEqual(name, GetClass.Property <CoachView>(name).Name);