public void RandomPCodesAreNotNLincsAnon([Values("TN4",
                                                         "DN3",
                                                         "DN17",
                                                         "DN37",
                                                         "DN33",
                                                         "CH5",
                                                         "M1",
                                                         "DN 3",
                                                         "W1P",
                                                         "EC1A")]
                                                 string outcode,
                                                 [Values("9BP",
                                                         "3AZ",
                                                         "3DE",
                                                         "2JT",
                                                         "3HW")]
                                                 string incode)

        {
            var pcode = new PostCode(outcode + " " + incode);

            var actual = pcode.IsNorthlincsAnonymousPostcode();

            Assert.That(actual, Is.False);
        }
Beispiel #2
0
        public void MosaicPostCode([Values("TN4",
                                           "DN 3",
                                           "M1")]
                                   string outcode,
                                   [Values("9BP",
                                           "3AZ",
                                           "3DE")]
                                   string incode,
                                   [Values("TN 4 9BP",
                                           "DN 3 3AZ",
                                           "M  1 3DE")]
                                   string expect)
        {
            // Arrange
            var expected = expect;

            // Act

            var pCode = new PostCode(outcode + " " + incode);

            Assert.That(pCode,
                        Is.Not.Null);

            var actual = pCode.MosaicPostCode();

            // Assert

            Assert.That(actual,
                        Is.Not.Null);
            Assert.That(actual,
                        Is.EqualTo(expected));
        }
        public void RandomInvalidPCodesAreFalse([Values("TN4444",
                                                        "     ",
                                                        "DN 23 33 23",
                                                        "3",
                                                        "-",
                                                        "ABCDEFGHIJKLMNO",
                                                        "C",
                                                        ""
                                                        )]
                                                string outcode,
                                                [Values("",
                                                        "AZ",
                                                        "3D",
                                                        "2",
                                                        "C",
                                                        "9ZZ",
                                                        "   ")]
                                                string incode)
        {
            var input = new PostCode(outcode + " " + incode);

            var actual = input.IsValidUkPostCode();

            Assert.That(actual,
                        Is.Not.Null);
            Assert.That(actual,
                        Is.False);
        }
Beispiel #4
0
        internal List <Agency> CreateAgenciesForCode(PostCode code)
        {
            var agencyOfficeList = new List <Agency>();

            var agencies = _context.Agencies.Include(x => x.Agents).Where(x => x.PostCode == code.Code).ToList();

            // perform check to see if we already have agencies created for this post code
            if (!agencies.Any())
            {
                foreach (var agencyComp in agencyCompanies)
                {
                    agencyOfficeList.Add(new Agency
                    {
                        AgencyCompany     = agencyCompanies.Where(x => x.Name == agencyComp.Name).Single(),
                        AgencyCompanyName = agencyComp.Name,
                        AgencyOfficeName  = agencyComp.Name + " " + ToTitleCase(code.Locality),
                        PostCode          = code.Code,
                        Locality          = code.Locality,
                        Agents            = GenerateAgents(agencyComp.Name),
                        LogoImageUrl      = agencyComp.LogoImageUrl
                    });
                }
                ;
                _context.AddRange(agencyOfficeList);
                _context.SaveChanges();
                return(agencyOfficeList);
            }
            else
            {
                //var agencyxList = _context.Agencies.Include(x => x.Agents).ToList();
                return(agencies);
            }
        }
Beispiel #5
0
        public void EmptyPostCodeIsUnknown()
        {
            var pcode = new PostCode();

            Assert.That(pcode, Is.Not.Null);
            Assert.That(pcode.Unknown, Is.True);
        }
Beispiel #6
0
        public static void Main(string[] args)
        {
            bool                    acceptcookies           = true;
            PostCode                postCodeCls             = new PostCode();
            List <string>           postCodes               = postCodeCls.loadCsvFile();
            ViewTariffAndPricesPage viewTariffAndPricesPage = new ViewTariffAndPricesPage();
            Homepage                homepage          = new Homepage();
            EnterPostcodePage       enterPostcodePage = new EnterPostcodePage();

            foreach (string postcode in postCodes)
            {
                homepage.navigateToHomePage(url);
                if (acceptcookies)
                {
                    homepage.acceptCookies();
                    acceptcookies = false;
                }

                homepage.clickOnTariffsAndPrices();
                enterPostcodePage.viewTariffs(postcode);
                String actualStandingCharge = viewTariffAndPricesPage.get1YearDirectDebitTariffValue();
                Assert.AreEqual("21.04", actualStandingCharge);
            }
            viewTariffAndPricesPage.closeBrowser();
        }
Beispiel #7
0
        public void TestEquality([Values("TN4",
                                         "DN3",
                                         "DN17",
                                         "DN37",
                                         "DN33",
                                         "CH5",
                                         "M1",
                                         "DN 3",
                                         "W1P",
                                         "EC1A")]
                                 string outcode,
                                 [Values("9BP",
                                         "3AZ",
                                         "3DE",
                                         "2JT",
                                         "3HW")]
                                 string incode)
        {
            // Arrange

            // Act
            var postCode = CreatePostCode();

            postCode.Value = outcode + " " + incode;
            var pCode = new PostCode(outcode + " " + incode);

            // Assert

            Assert.That(postCode,
                        Is.Not.Null);
            Assert.That(pCode,
                        Is.Not.Null);
            Assert.That(postCode.Value,
                        Is.EqualTo(pCode.Value));
        }
Beispiel #8
0
        /// <summary>
        ///   Converts current object to a PSV row
        /// </summary>
        public string ToPsvRow()
        {
            string[] data =
            {
                OrderId.ToString(),
                ProgramName,
                OrderDate.ToString(Constants.DateTimeIsoFormat),
                LastName,
                FirstName,
                SpouseName,
                string.Join(",",                                  Children),
                Address,
                Suburb,
                State,
                PostCode.ToString(),
                TelNo,
                MobileNo,
                SpouseMobileNo,
                Email1,
                Email2,
                PaymentDate.ToString(Constants.DateTimeIsoFormat),
                OrderStatus
            };

            return(string.Join("|", data));
        }
Beispiel #9
0
 public Address(Prefecture prefecture, string city, PostCode postCode, string belowAddress)
 {
     this.prefecture   = prefecture;
     this.city         = city;
     this.postCode     = postCode;
     this.belowAddress = belowAddress;
 }
Beispiel #10
0
        public void fillAddress()
        {
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            Addressline1.Clear();
            Addressline1.SendKeys(ExcelOperation.GetData[9]);

            SuburbText.Clear();
            AddressLine2.Clear();
            AddressLine2.SendKeys(ExcelOperation.GetData[10]);
            SuburbText.SendKeys(ExcelOperation.GetData[11]);

            State.Click();
            PostCode.Clear();
            PostCode.SendKeys(ExcelOperation.GetData[12]);
            PostalAddressLine1.Clear();

            PostalAddressLine1.SendKeys(ExcelOperation.GetData[13]);
            PostalAddressLine2.Clear();
            PostalAddressLine2.SendKeys(ExcelOperation.GetData[14]);
            PostalSuburbText.Clear();
            PostalSuburbText.SendKeys(ExcelOperation.GetData[15]);

            PostalStateCombo.Click();
            PostalPostCode.Clear();
            PostalPostCode.SendKeys(ExcelOperation.GetData[16]);
            GenericHelper.AllScreenShot(driver);
            Nextbutton.Click();
        }
        public void Execute(DocumentStore store)
        {
            _postCodes = new List<PostCode>();
            string[] readAllLines = File.ReadAllLines(@"C:\coding\SchoolsNearMe\Collateral\postcodes to Lat Long.csv");
            foreach (string readAllLine in readAllLines.Skip(1))
            {
                string[] items = readAllLine.Split(',');
                var p = new PostCode
                    {
                        PostalCode = items[1],
                        Position =
                            new Position {Latitude = Convert.ToDouble(items[2]), Longitude = Convert.ToDouble(items[3])}
                    };
                _postCodes.Add(p);
            }
            StreamWriter streamWriter = File.CreateText(@"C:\coding\SchoolsNearMe\Collateral\mislocated schools.txt");
            _store = store;

            new RavenEach().RavenForEach<School>(store, CheckDistance);
            foreach (var distance in _distances.Distinct().OrderByDescending(x=>x.Key).Take(100))
            {
                string format = string.Format("{0} - {1} - {2}", distance.Value.Id, distance.Value.SchoolName, distance.Key);
                Console.WriteLine(format);
                streamWriter.WriteLine(format);
            }
            streamWriter.Flush();
            streamWriter.Close();
            Console.WriteLine("Avg:{0}", _distances.Average(x=>x.Key));
            Console.ReadLine();
        }
        public void AddPropertyDetails()
        {
            obj.ClickAddNewProperty();

            // Populating the data from Excel
            ExcelLib.PopulateInCollection(Base.ExcelPath, "PropertyDetails");

            PropertyName.SendKeys(ExcelLib.ReadData(2, "PropertyName"));
            SearchAddress.SendKeys(ExcelLib.ReadData(2, "SearchAddress"));
            Description.SendKeys(ExcelLib.ReadData(2, "Description"));
            Number.SendKeys(ExcelLib.ReadData(2, "Number"));
            Street.SendKeys(ExcelLib.ReadData(2, "Street"));
            Suburb.SendKeys(ExcelLib.ReadData(2, "Suburb"));
            City.SendKeys(ExcelLib.ReadData(2, "City"));
            PostCode.SendKeys(ExcelLib.ReadData(2, "PostCode"));
            Region.SendKeys(ExcelLib.ReadData(2, "Region"));
            YearBuilt.SendKeys(ExcelLib.ReadData(2, "YearBuilt"));
            TargetRent.SendKeys(ExcelLib.ReadData(2, "TargetRent"));
            LandArea.SendKeys(ExcelLib.ReadData(2, "LandArea"));
            FloorArea.SendKeys(ExcelLib.ReadData(2, "FloorArea"));
            BedRooms.SendKeys(ExcelLib.ReadData(2, "Bedrooms"));
            BathRooms.SendKeys(ExcelLib.ReadData(2, "Bathrooms"));
            CarPark.SendKeys(ExcelLib.ReadData(2, "Carparks"));
            owneroccupied = ExcelLib.ReadData(2, "Owner Occupied");
            if (owneroccupied == "Yes")
            {
                OwnerOccupied.Click();
            }


            Next.Click();
            AddFinanceDetails();
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (StreetName.Length != 0)
            {
                hash ^= StreetName.GetHashCode();
            }
            if (BuildingNumber != 0)
            {
                hash ^= BuildingNumber.GetHashCode();
            }
            if (AddressLine.Length != 0)
            {
                hash ^= AddressLine.GetHashCode();
            }
            if (PostCode.Length != 0)
            {
                hash ^= PostCode.GetHashCode();
            }
            if (TownName.Length != 0)
            {
                hash ^= TownName.GetHashCode();
            }
            if (Country.Length != 0)
            {
                hash ^= Country.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #14
0
        private void SaveAndPop()
        {
            UserTable userChanges = new UserTable();

            userChanges = user;

            userChanges.UserName  = UserName.Trim();
            userChanges.FirstName = FirstName.Trim();
            userChanges.LastName  = LastName.Trim();
            userChanges.Email     = Email.Trim();
            userChanges.Address1  = Address1.Trim();
            if (Address2 != null)
            {
                userChanges.Address2 = Address2.Trim();
            }

            if (Address3 != null)
            {
                userChanges.Address3 = Address3.Trim();
            }

            userChanges.PostCode = PostCode.Trim();
            userChanges.City     = City.Trim();
            userChanges.Country  = Country.Trim();
            userChanges.Phone    = int.Parse(Phone.Trim());
        }
        public void ArbitraryPCodesAreValid([Values("TN4",
                                                    "DN3",
                                                    "DN17",
                                                    "DN37",
                                                    "DN33",
                                                    "CH5",
                                                    "M1",
                                                    "DN 3",
                                                    "W1P",
                                                    "EC1A")]
                                            string outcode,
                                            [Values("9BP",
                                                    "3AZ",
                                                    "3DE",
                                                    "2JT",
                                                    "3HW")]
                                            string incode)
        {
            var input = new PostCode(outcode + " " + incode);

            var actual = input.IsValidUkPostCode();

            Assert.That(actual,
                        Is.Not.Null);
            Assert.That(actual,
                        Is.True);
        }
Beispiel #16
0
        public void NullPostCodeDoesNotError()
        {
            var actual = new PostCode(null);

            Assert.That(actual, Is.Not.Null);

            Assert.That(actual.Value, Is.EqualTo(""));
        }
Beispiel #17
0
        public ActionResult DeleteConfirmed(int id)
        {
            PostCode postCode = db.PostCodes.Find(id);

            db.PostCodes.Remove(postCode);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            PostCode postCode = await db.PostCodes.FindAsync(id);

            db.PostCodes.Remove(postCode);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Beispiel #19
0
        public void AnonPostCodeIsRecognised()
        {
            var input = new PostCode("DN00 000");

            var actual = input.IsAnonymous();

            Assert.That(actual,
                        Is.True);
        }
Beispiel #20
0
 public ActionResult Edit([Bind(Include = "pID,postcode,latitude,longitude")] PostCode postCode)
 {
     if (ModelState.IsValid)
     {
         db.Entry(postCode).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(postCode));
 }
Beispiel #21
0
        public void GivenRawFormatIsInvalid_ShouldThrowFormatException(string postCodeRaw)
        {
            // Arrange

            // Act
            TestDelegate act = () => { var postCode = new PostCode(postCodeRaw); };

            // Assert
            Assert.Throws <FormatException>(act);
        }
Beispiel #22
0
        public void CanCreatePostCode(string postCodeRaw)
        {
            // Arrange

            // Act
            TestDelegate act = () => { var postCode = new PostCode(postCodeRaw); };

            // Assert
            Assert.DoesNotThrow(act);
        }
Beispiel #23
0
        public ActionResult Create([Bind(Include = "pID,postcode,latitude,longitude")] PostCode postCode)
        {
            if (ModelState.IsValid)
            {
                db.PostCodes.Add(postCode);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(postCode));
        }
 private void LoadAddressIntoView(UserAddress userAddress)
 {
     currentAddress = userAddress;
     FirstName.InitializeValue(userAddress.FirstName);
     LastName.InitializeValue(userAddress.LastName);
     AddressLine1.InitializeValue(userAddress.AddressLine1);
     AddressLine2.InitializeValue(userAddress.AddressLine2);
     City.InitializeValue(userAddress.City);
     Country.InitializeValue(userAddress.Country);
     PostCode.InitializeValue(userAddress.PostCode);
     State.InitializeValue(userAddress.State);
 }
 public void FillNessesaryAccountInformation(RegistrationUser user)
 {
     FirstName.SendKeys(user.FirstName);
     LastName.SendKeys(user.LastName);
     Password.SendKeys(user.Password);
     Address.SendKeys(user.Address);
     City.SendKeys(user.City);
     State.SelectByText(user.State);
     PostCode.SendKeys(user.PostCode);
     MobilePhone.SendKeys(user.MobilePhone);
     TryClearFiledBeforeType(Alias, user.Alias);
 }
        public async Task <ActionResult> Edit([Bind(Include = "Id,PostCodeName,TaxRate")] PostCode postCode)
        {
            if (ModelState.IsValid)
            {
                db.Entry(postCode).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.TaxRate = new SelectList(db.Types, "TypeRate", "TypeRate", postCode.TaxRate);
            return(View(postCode));
        }
Beispiel #27
0
        public void PostCode_ExpectedBehaviour()
        {
            var outward = "DN33";
            var inward  = "3DE";

            var expected = "DN33 3DE";

            var actual = new PostCode(outward, inward);

            Assert.That(actual, Is.Not.Null);
            Assert.That(actual.Value, Is.EqualTo(expected));
        }
Beispiel #28
0
        public void TestArea([Values("TN4",
                                     "DN3",
                                     "DN17",
                                     "DN37",
                                     "DN33",
                                     "CH5",
                                     "M1",
                                     "DN 3",
                                     "W1P",
                                     "EC1A")]
                             string outcode,
                             [Values("9BP",
                                     "3AZ",
                                     "3DE",
                                     "2JT",
                                     "3HW",
                                     "9BP",
                                     "3AZ",
                                     "3DE",
                                     "2JT",
                                     "3HW")]
                             string incode,
                             [Values("TN",
                                     "DN",
                                     "DN",
                                     "DN",
                                     "DN",
                                     "CH",
                                     "M",
                                     "DN",
                                     "W",
                                     "EC")]
                             string expect)
        {
            // Arrange
            var expected = expect;

            // Act

            var pCode = new PostCode(outcode + " " + incode);

            Assert.That(pCode,
                        Is.Not.Null);

            var actual = pCode.Area;

            // Assert

            Assert.That(actual,
                        Is.Not.Null);
            Assert.That(actual,
                        Is.EqualTo(expected));
        }
 public void FillForm(RegistrationUser user)
 {
     FirstName.SetText(user.FirstName);
     LastName.SetText(user.LastName);
     Password.SetText(user.Password);
     City.SetText(user.City);
     Address.SetText(user.Address);
     PostCode.SetText(user.PostCode);
     State.SetText(user.State);
     Phone.SetText(user.Phone);
     Submit.ScrollTo().ToBeVisible().Click();
 }
Beispiel #30
0
        public void EnterUserDetail()
        {
            SignInBtn.Click();
            EmailAddress.SendKeys("*****@*****.**");
            BasePage.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            CreateAcccontBtn.Click();

            // AC 4.1 create user account
            Gender.Click();
            FirstName.SendKeys("Nadeem");
            LastName.SendKeys("Digital");
            Password.SendKeys("123qwe");

            SelectElement DropDay = new SelectElement(Day);

            DropDay.SelectByValue("10");
            SelectElement DropMonth = new SelectElement(Month);

            DropMonth.SelectByValue("9");
            SelectElement DropYear = new SelectElement(Year);

            DropYear.SelectByValue("2020");

            CheckedSpecialOffer.Click();
            AddressFirstName.SendKeys("Nadeem");
            AddressLastName.SendKeys("Digital");
            Company.SendKeys("Test Digital Company");
            Address1.SendKeys("Leeds Town");
            Address2.SendKeys("LS1");
            City.SendKeys("Leeds");

            SelectElement DropDown = new SelectElement(State);

            DropDown.SelectByText("Florida");

            PostCode.SendKeys("00012");
            AdditionalInfo.SendKeys("This is first programme of testig");
            MobileNo.SendKeys("123456789");
            AddressFutureRef.SendKeys("NB_Test");
            ClickRegisterUser.Click();

            //AC 4.4 verify account namme
            Assert.AreEqual("Nadeem Digital", VerifyUser.Text);
            Console.WriteLine(VerifyUser.Text + " Displayed");


            Bpage.Imp_wait();
            //AC 4.3 verify user taken to MY ACCOUNT page
            Assert.IsTrue(Pageheading.Displayed);
            Console.WriteLine(Pageheading.Text + " Displayed");

            SignOut.Click();
        }
Beispiel #31
0
        public void FillFormWithoutState(FormModel user)
        {
            FirstName.SendKeys(user.FirstName);
            LastName.SendKeys(user.LastName);
            Password.SendKeys(user.Password);
            Address.SendKeys(user.Address);
            City.SendKeys(user.City);
            PostCode.SendKeys(user.PostCode);
            PhoneNumber.SendKeys(user.PhoneNumber);

            Driver.ScrollTo(RegisterButton);
            RegisterButton.Click();
        }
 void CheckIfZipCodeMatchesCountry(PostCode postCode, string countryId)
 {
     /* validates zip code */
 }