Пример #1
0
        public void Mortage_invalid_characters_in_the_email_are_removed()
        {
            MortgageRequest request = mortageSystem
                                      .GetInvalidRequests("TestFiles/Mortage_with_invalid_characters_in_the_email_are_removed.txt")
                                      .FirstOrDefault();

            Assert.AreEqual("*****@*****.**", request.Email, "The email has not contain # elements");
        }
Пример #2
0
        public void Mortage_is_invalid_if_Home_Appraisal_is_more_than_gross_mensual_salary()
        {
            string          filePath = "TestFiles/Mortage_is_invalid_if_Home_Appraisal_is_more_than_gross_mensual_salary.txt";
            MortgageRequest request  = mortageSystem
                                       .GetInvalidRequests(filePath)
                                       .FirstOrDefault();

            Assert.IsTrue(request.HomeAppraisal > request.GrossMensualSalary);
        }
Пример #3
0
        public void When_a_mortgage_is_readed_from_a_file_line_all_state_is_properly_set()
        {
            string fileName = "TestFiles/When_a_mortgage_is_readed_from_a_file_line_all_state_is_properly_assigned.txt";
            IList <MortgageRequest> resquests        = mortageSystem.GetInvalidRequests(fileName);
            MortgageRequest         expectedMortgage = new MortgageRequest()
            {
                MortageRequestId   = 271234,
                ClientId           = 1,
                Debts              = 50.20f,
                Email              = "*****@*****.**",
                GrossMensualSalary = 0.00f,
                HomeAppraisal      = 280000.00f,
                Incomes            = 0.00f,
                Nif             = "94590756J",
                TelephoneNumber = "652215505",
                AddressNumber   = 123,
                City            = "Madrid",
                Street          = "street micenas",
                ZipCode         = "28232",
                State           = "Madrid"
            };

            // Check only one mortgage request.
            Assert.IsTrue(resquests.Count == 1);

            // Check not a null request.
            MortgageRequest request = resquests.FirstOrDefault();

            Assert.IsNotNull(request);

            // Check each field mapping is properly done.

            Assert.AreEqual(request.MortageRequestId, expectedMortgage.MortageRequestId);
            Assert.AreEqual(request.ClientId, expectedMortgage.ClientId);
            Assert.AreEqual(request.Debts, expectedMortgage.Debts);
            Assert.AreEqual(request.Email, expectedMortgage.Email);
            Assert.AreEqual(request.GrossMensualSalary, expectedMortgage.GrossMensualSalary);
            Assert.AreEqual(request.HomeAppraisal, expectedMortgage.HomeAppraisal);
            Assert.AreEqual(request.Incomes, expectedMortgage.Incomes);
            Assert.AreEqual(request.Nif, expectedMortgage.Nif);
            Assert.AreEqual(request.TelephoneNumber, expectedMortgage.TelephoneNumber);
            Assert.AreEqual(request.AddressNumber, expectedMortgage.AddressNumber);
            Assert.AreEqual(request.City, expectedMortgage.City);
            Assert.AreEqual(request.Street, expectedMortgage.Street);
            Assert.AreEqual(request.ZipCode, expectedMortgage.ZipCode);
            Assert.AreEqual(request.State, expectedMortgage.State);
        }
Пример #4
0
        public void Mortgage_the_abbreviation_of_street_is_replaced()
        {
            MortgageRequest request = mortageSystem.GetInvalidRequests("TestFiles/The_abbreviation_of_street_are_removed.txt").FirstOrDefault();

            Assert.AreEqual("street micenas", request.Street, "Street does not contain its abbreviature");
        }
Пример #5
0
        public void Mortage_with_invalid_characters_in_the_zipCode_are_removed()
        {
            MortgageRequest request = mortageSystem.GetInvalidRequests("TestFiles/Mortage_with_invalid_characters_in_the_zipCode_are_removed.txt").FirstOrDefault();

            Assert.AreEqual("28232", request.ZipCode, "The zipcode has contain not valid character");
        }
Пример #6
0
        public void Mortage_is_invalid_when_debts_are_greater_than_incomes()
        {
            MortgageRequest request = mortageSystem.GetInvalidRequests("TestFiles/Mortage_cannot_have_more_debts_than_income.txt").FirstOrDefault();

            Assert.IsTrue(request.Debts > request.Incomes);
        }
Пример #7
0
        public void The_abbreviation_of_City_are_replaced()
        {
            MortgageRequest request = mortageSystem.GetInvalidRequests("TestFiles/The_abbreviation_of_City_are_removed.txt").FirstOrDefault();

            Assert.AreEqual("Madrid", request.City, "The city has contain not valid character");
        }