public void MatchInDB_OnAreaCode()
        {
            TestPhoneNumber pNbr = this.RunTimeZoneTest(true, false, null);

            this.RunTimeZoneTest(false, false, pNbr);

            Assert.IsTrue(_db.AreaCodes.Count() == 1);
        }
        public void AC_NotFoundInWebService_ButMatchInDB_OnState()
        {
            this.RunTimeZoneTest(true, false, null);

            TestPhoneNumber nbr = this.RandomNumber(false);

            this.RunTimeZoneTest(false, false, nbr);
        }
        public void MultipleCalls_SameAreaCode_OneRecord()
        {
            TestPhoneNumber phNbr = this.RandomNumber(false);

            RunTimeZoneTest(true, true, phNbr);
            RunTimeZoneTest(false, true, phNbr);

            Assert.IsTrue(_db.AreaCodes.Where(a => a.AreaCode == phNbr.AreaCode).Count() == 1);
        }
        private void GetTimeZone(TestPhoneNumber phNbr, bool shouldBeUnknown)
        {
            _logic.ProcessTextMessageReceived(phNbr.Country, phNbr.State, phNbr.City, phNbr.PhoneNumber, "TZ");
            UGitFit.Model.TimeZone tz = _db.FindTimezoneByAreaCode(phNbr.AreaCode);

            Assert.IsTrue((tz.ReferenceText == "UNKNOWN") == shouldBeUnknown);
            if (!shouldBeUnknown)
            {
                Assert.IsTrue(tz.ReferenceText == phNbr.TimeZone);
            }
        }
        private TestPhoneNumber RunTimeZoneTest(bool resetFirst, bool shouldBeUnknown, TestPhoneNumber ph)
        {
            TestPhoneNumber result = ph;

            if (ph == null)
            {
                result = this.RandomNumber((shouldBeUnknown == false));
            }

            if (resetFirst)
            {
                this.ResetAreaCodes();
            }

            _logic.ProcessTextMessageReceived(result.Country, result.State, result.City, result.PhoneNumber, "TZ");
            this.GetTimeZone(result, shouldBeUnknown);

            return(result);
        }
        private void TestSpecificTimeZonePhoneNumberForSuccess(string timezoneToTest)
        {
            TestPhoneNumber phnNbr = TestPhoneNumberFactory.GetTestPhoneNumbersList().Where(t => t.TimeZone == timezoneToTest && t.AreaCodeServiceWorks == true).First();

            this.RunTimeZoneTest(true, false, phnNbr);
        }