Ejemplo n.º 1
0
        public void ChangeFromDate_MinusTwoDays()
        {
            app.WaitForElement(c => c.Text("From:"));

            var fromDayMinusButton = app.Query(c => c.Text("-"))[0];

            for (int i = 0; i < 2; i++)
            {
                app.TapCoordinates(fromDayMinusButton.Rect.CenterX, fromDayMinusButton.Rect.CenterY);
            }

            long threeDaysBefore = 0;
            long twoDaysBefore   = 0;
            long oneDayBefore    = 0;
            long today           = 0;
            long tomorrow        = 0;


            if (NowDay > 3)
            {
                threeDaysBefore = (long)app.Query(c => c.Descendant("CalendarView").Button().Text((NowDay - 3).ToString()).Invoke("getBackground").Invoke("getColor")).SingleOrDefault();
            }
            if (NowDay > 2)
            {
                twoDaysBefore = (long)app.Query(c => c.Descendant("CalendarView").Button().Text((NowDay - 2).ToString()).Invoke("getBackground").Invoke("getColor")).SingleOrDefault();
            }
            if (NowDay > 1)
            {
                oneDayBefore = (long)app.Query(c => c.Descendant("CalendarView").Button().Text((NowDay - 1).ToString()).Invoke("getBackground").Invoke("getColor")).SingleOrDefault();
            }

            today = (long)app.Query(c => c.Descendant("CalendarView").Button().Text(NowDay.ToString()).Invoke("getBackground").Invoke("getColor")).SingleOrDefault();

            if (NowDay < DateTime.DaysInMonth(NowYear, NowMonth))
            {
                tomorrow = (long)app.Query(c => c.Descendant("CalendarView").Button().Text((NowDay + 1).ToString()).Invoke("getBackground").Invoke("getColor")).SingleOrDefault();
            }

            Assert.AreEqual(0, threeDaysBefore);
            Assert.AreEqual(-16776961, twoDaysBefore);
            Assert.AreEqual(-16776961, oneDayBefore);
            Assert.AreEqual(-16776961, today);
            Assert.AreEqual(0, tomorrow);
        }