static void PrintMagicDetails(MagicYearCalculator person) { Console.WriteLine("\nYour magic age details are:\n"); Console.WriteLine($"Name: {person.GetFullName()}"); Console.WriteLine($"Monthly Salary: {person.GetMonthlySalary()}"); Console.WriteLine($"Magic Year: {person.GetMagicYear()}"); }
public void GetFullName() { var magicYearCalculator = new MagicYearCalculator("John", "Doe", It.IsAny <int>(), It.IsAny <int>()); var fullName = magicYearCalculator.GetFullName(); Assert.Equal("John Doe", fullName); }
public void GetMagicYear() { var magicYearCalculator = new MagicYearCalculator(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), 1980); var magicYear = magicYearCalculator.GetMagicYear(); Assert.Equal(2045, magicYear); }
public void GetMonthlySalary() { var magicYearCalculator = new MagicYearCalculator(It.IsAny <string>(), It.IsAny <string>(), 60050, It.IsAny <int>()); var monthlySalary = magicYearCalculator.GetMonthlySalary(); Assert.Equal(5004, monthlySalary); }
private static void Main(string[] args) { ICommand command = new ShowWelcomeMessageAndPromptForName(); do { Console.Write(command.output); var input = Console.ReadLine(); command = MagicYearCalculator.ProcessCommand(command, input); } while (!(command is CloseProgram)); }
static void Main(string[] args) { Console.WriteLine("Please input your name: "); var name = Console.ReadLine(); Console.WriteLine("Please input your surname: "); var surname = Console.ReadLine(); Console.WriteLine("Please enter your annual salary: "); var annualSalary = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Please enter your work start year: "); var workStartYear = Convert.ToInt32(Console.ReadLine()); var person1 = new MagicYearCalculator(name, surname, annualSalary, workStartYear); PrintMagicDetails(person1); }