Ejemplo n.º 1
0
        public void Test_Clear_IOFile()
        {
            var testLogHelper = new TestLogHelper();

            testLogHelper.ClearMortgages();

            string filepath = testLogHelper.GetFilePath();

            Assert.AreEqual(new FileInfo(filepath).Length, 0);
        }
Ejemplo n.º 2
0
        public void Test_Add_IOFile()
        {
            var testLogHelper = new TestLogHelper();

            string text = $"With a principal of $1000, duration of 2 years and an interest rate of 3%, the monthly loan payment amount is $42.98";

            testLogHelper.AddMortgage(text, 1000, 3, 2, 4000);

            string expectedtext = File.ReadLines(testLogHelper.GetFilePath()).Last().Split(';')[0];

            Assert.AreEqual(expectedtext, text);
            testLogHelper.ClearMortgages();
        }
Ejemplo n.º 3
0
        public void Test_ListData_IOFile()
        {
            var testLogHelper = new TestLogHelper();

            testLogHelper.ClearMortgages();

            string actualtext1 = $"With a principal of $1000, duration of 2 years and an interest rate of 3%, the monthly loan payment amount is $42.98";
            string actualtext2 = $"With a principal of $1500, duration of 3 years and an interest rate of 3.5%, the monthly loan payment amount is $43.95";

            testLogHelper.AddMortgage(actualtext1, 1000, 3, 2, 4000);
            testLogHelper.AddMortgage(actualtext2, 1000, 3, 2, 4000);

            List <MortageInfo> testlogList = testLogHelper.GetAllMortgages();

            Assert.AreEqual(testlogList[0].MortgageString, actualtext1);
            Assert.AreEqual(testlogList[1].MortgageString, actualtext2);

            testLogHelper.ClearMortgages();
        }