public void ReadJsonFile_WhenExistFileAndRolIsAdmin_CheckResultOk()
        {
            var fileContent = FileReaderManager.ReadFile(ConfigurationHelper.JsonFilePath, rolType: FileReaderHelper.RolType.Admin);

            Assert.AreNotEqual(fileContent, String.Empty);
        }
        public void ReadEncryptedFile_WhenNotExistFile_CheckEmptyContent()
        {
            var fileContent = FileReaderManager.ReadFile(ConfigurationHelper.EncryptedFilePath + "123", true);

            Assert.AreEqual(fileContent, String.Empty);
        }
        public void ReadEncryptedFile_WhenExistFile_CheckResultOk()
        {
            var fileContent = FileReaderManager.ReadFile(ConfigurationHelper.EncryptedFilePath, true);

            Assert.AreEqual(fileContent, ConfigurationHelper.EncryptedText);
        }
 public void ReadXMLFile_WhenExistFileAndRolIsNoAdmin_CheckException()
 {
     FileReaderManager.ReadFile(ConfigurationHelper.XMLFilePath);
 }
        public void ReadTextFile_WhenExistFileAndRolIsNoAdmin_CheckException()
        {
            var fileContent = FileReaderManager.ReadFile(ConfigurationHelper.TextFilePath);

            Assert.AreNotEqual(fileContent, String.Empty);
        }
Example #6
0
        static void Main(string[] args)
        {
            List <Staff> listOfStaffObjects = new List <Staff>();
            int          month = 0; int year = 0;

            while (year == 0)
            {
                try
                {
                    Console.Write("Please enter the year: ");
                    year = Convert.ToInt32(Console.ReadLine());

                    while (month == 0)
                    {
                        try
                        {
                            Console.Write("Please enter the month: ");
                            month = Convert.ToInt32(Console.ReadLine());

                            if (month < 1 || month > 12)
                            {
                                Console.WriteLine("Invalid month entered.");
                                month = 0;
                            }
                            else
                            {
                                FileReaderManager fileReaderManager = new FileReaderManager();
                                listOfStaffObjects = fileReaderManager.ReadFile();
                                for (int i = 0; i < listOfStaffObjects.Count; i++)
                                {
                                    try
                                    {
                                        Console.WriteLine("Enter the hours work for " + listOfStaffObjects[i].NameOfStaff + ": ");
                                        listOfStaffObjects[i].HoursWorked = Convert.ToInt32(Console.ReadLine());

                                        listOfStaffObjects[i].CalculatePay();
                                        Console.WriteLine(listOfStaffObjects[i].ToString());

                                        Payslip ps = new Payslip(year, month);
                                        ps.GeneratePaySlip(listOfStaffObjects);
                                        ps.GenerateSummary(listOfStaffObjects);
                                        Console.Read();
                                    }
                                    catch (Exception ex)
                                    {
                                        i--;
                                        Console.WriteLine(ex.Message);
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                        }
                    }
                }
                catch (FormatException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }