コード例 #1
0
        public void ReadFile_FileIsEmpty()
        {
            string fileName = "EmptyFile.txt";

            CreateEmptyInputFile(fileName);
            IFileHelper expenseFileHelper = new ExpenseFileHelper(fileName);

            expenseFileHelper.ReadFile();
        }
コード例 #2
0
        public void ValidateFile_NothingToProcess()
        {
            string fileName = "FileNothingToProcess.txt";

            CreateInputFileNothingToProcess(fileName);
            IFileHelper expenseFileHelper = new ExpenseFileHelper(fileName);

            expenseFileHelper.ReadFile();
            expenseFileHelper.ValidateFile();
        }
コード例 #3
0
        public void CreateOutput_CheckOutputName()
        {
            string fileName = "TestExpenses.txt";

            CreateInputFile(fileName);
            IFileHelper expenseFileHelper = new ExpenseFileHelper(fileName);

            expenseFileHelper.ReadFile();
            expenseFileHelper.ValidateFile();
            expenseFileHelper.CreateOutput();

            Assert.IsTrue(FileExists(fileName + ".out"));
        }
コード例 #4
0
        public void ValidateFile_CheckExpenses()
        {
            string fileName = "TestExpenses.txt";

            CreateInputFile(fileName);
            IFileHelper expenseFileHelper = new ExpenseFileHelper(fileName);

            expenseFileHelper.ReadFile();
            expenseFileHelper.ValidateFile();
            List <Expense> expenses = expenseFileHelper.GetExpenses();

            Assert.AreEqual(expenses.Count, 1);
            Assert.AreEqual(expenses[0].Participants.Count, 2);
            Assert.AreEqual(expenses[0].Participants[0].TotalCharge, 14.00);
            Assert.AreEqual(expenses[0].Participants[1].TotalCharge, 15.95);
        }
コード例 #5
0
        public void ReadFile_NoExists()
        {
            IFileHelper expenseFileHelper = new ExpenseFileHelper("NoFile.txt");

            expenseFileHelper.ReadFile();
        }