コード例 #1
0
        static void Main(string[] args)
        {
            Console.Write("SalaryFrequency" + "\t\t\t" + "Day" + "\t" + "Week" + "\t" + "Current Date" + "\t" + "Next Salary Date" + "\n");


            foreach (var SalaryDate in TestData())
            {
                var SalaryDateCalculation = new SalaryDateCalculation();

                SalaryDateCalculation.SetCurrentDateTime(SalaryDate.CurrentDateTime);

                var Actual = SalaryDateCalculation.CalculateNextSalaryDate(new SalaryDateCalculationDto
                {
                    Day = SalaryDate.Day,
                    PaymentFrequency = SalaryDate.Frequency,
                    Week             = SalaryDate.Week
                });

                var PaymentFrequency = Enum.GetName(typeof(SalaryFrequency), SalaryDate.Frequency);
                Console.BackgroundColor = ConsoleColor.Blue;
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write($"{SalaryDate.Frequency}" + (PaymentFrequency.Length > 9
                                                            ? "\t\t"
                                                            : "\t\t\t")
                              + SalaryDate.Day + "\t"
                              + SalaryDate.Week + "\t"
                              + $"{SalaryDate.CurrentDateTime:dd.MM.yyyy}" + "\t"
                              + $"{Actual:dd.MM.yyyy}" + "\n");

                Console.WriteLine();
            }
        }
コード例 #2
0
        protected void Calculate(SalaryDateTestModel salaryData)
        {
            var SalaryDateCalculation = new SalaryDateCalculation();

            SalaryDateCalculation.SetCurrentDateTime(salaryData.CurrentDateTime);

            var Actual = SalaryDateCalculation.CalculateNextSalaryDate(new SalaryDateCalculationDto
            {
                Day = salaryData.Day,
                PaymentFrequency = salaryData.Frequency,
                Week             = salaryData.Week
            });
            var Expected = salaryData.NextSalaryDateTime;

            Assert.Equal(Expected, Actual);
        }